Show MySQL data in a field
Posted: Fri Jul 10, 2015 6:55 pm
On my LC card, I have a good connection to MySQL data on my server. I want to show the data from the connection in a field on the card. Here's my script, but it's not working. An error message is saying "error at line 11 ... char 9" My table name is "content" and my query seem correct. The field on my card it titled "schedule". Any ideas what's going on?
on mouseUp
-- check the global connection ID to make sure we have a database connection
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if
put "content" into tTableName
put "SELECT * FROM content WHERE `content_name` LIKE 'schedule'") into tSQL
-- query the database
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
-- check the result and display the data or an error message
if item 1 of tData = "revdberr" then
answer error "There was a problem querying the database:" & cr & tData
else
put tData into field "schedule"
end if
end mouseUp
on mouseUp
-- check the global connection ID to make sure we have a database connection
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if
put "content" into tTableName
put "SELECT * FROM content WHERE `content_name` LIKE 'schedule'") into tSQL
-- query the database
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
-- check the result and display the data or an error message
if item 1 of tData = "revdberr" then
answer error "There was a problem querying the database:" & cr & tData
else
put tData into field "schedule"
end if
end mouseUp