MYSQL syntax error
Posted: Fri Mar 04, 2011 5:17 am
Hi i wonder of someone can identify the error here, i think it is around constructing the Mysql, The connection to the database is fine.
i get this error
compilation error at line 42 (Commands: bad parameter), char 33
Many thanks
Alex
Code: Select all
put "xxxxxxxxxx" into tDatabaseAddress
put "xxxxxxxx" into tDatabaseName
put "xxxxxxxx" into tDatabaseUser
put "xxxxxxxx" into tDatabasePassword
-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
-- check if it worked and display an error message if it didn't
-- & set the connection ID global
if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
--send data
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if
-- table name is php_pireps with 8 fields
put "phpvms_pireps" into tTableName
put "callsign, flightnum,depicao,arricao,flighttime,fuelused,comments" into tFields
put char 1 to 2 of "aircraft" into tAircraft
-- construct the SQL
put "INSERT INTO " & tTableName & " (" & tFields & ") ("& tAircraft &")" into tSQL -- poss errors here
-- send the SQL to the database,
revExecuteSQL gConnectionID, tSQL,
-- check the result and display the data or an error message
if the result is a number then
answer info "Success ! Your Pirep has been sent!"
else
answer error "There was a problem adding the record to the database:" & cr & the result
end if
compilation error at line 42 (Commands: bad parameter), char 33
Many thanks
Alex