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 ifcompilation error at line 42 (Commands: bad parameter), char 33
Many thanks
Alex

 
 




