Jump to content

Recommended Posts

Posted

Hi Guys

I am writing certain elements of an array to a text file, the text file is creating a mysql insert command like this

$line = "insert into tablename values('', '" & $data1 & "','" & $data2 & "')"

All works fine so far BUT mysql has some reserved words 'die' is one of them, the word it picked up on my data was diesel, so now I need to set the $data2 var to instead of being surrounded by 'data' it needs to be written from autoit like this "data" when its printed out, but as autoit uses "" for text and so does mysql I have a conflict, so I tried

$line = "insert into tablename values('', '" & $data1 & "',"" & $data2 & "")"

but autoit now sees the " as the end of its text, the data2 var is just printing $data2

Any ideas?

Posted (edited)

Thanks very much mate, works fine now in printing it out BUT just tried to import the contents to mysql and get this error

,"Di'

the word is Diesel_Powered

Any other way?

Edited by Phaser
Posted

Very strange, if I import the .txt file I get the error, but if I use the mysql tab window and paste the command in there it works any help much appreciated

Posted (edited)

Where does the " come from ...that is HTML.

Yes I know, it doesn't pick it up when I copy and paste the Autoit output into the mysql command text box to insert it but when I try to just import from the Autoit txt file (same created command) it errors like that, obviousley it would be too time consuming to copy n paste its much easier to upload the txt file content into mysql, its looking more like a mysql issue than autoit, but thought someone here may know both languages, anyone?

EDIT

Ok just found something else, maybe my line of text is missing something, if I paste 1 entry into mysql it works if I copy 2 or more it fails, should my Autoit output file have something at the end that mysql is looking for so it know its the next line? what does it need?

EDIT 2

OK sorted, it needs to add ; at the end of the mysql insert command, I should have known that one though, thanks for the help anyway

Edited by Phaser

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...