Newbie - MYSQL Connection Problems
Posted: Sun Feb 06, 2011 8:44 pm
I'm scratching my head on this one, and its probably because I don't know LiveCode well enough to figure it out for myself. It'll be one of those "duh" things.
Anyways, I have copied and slightly modified code from the "Exploring Revolution: Work with Databases" tutorial to connect to a MySQL database, and I'm not having much success.
This code produces an error Handler: can't find handler near "error", char 1. So I've tried replacing the RunRev database information with my localhost info (running WAMP), and I get past that error, but now I get Handler: can't find handler near "goNext", char 1.
If I understand it correctly, goNext will go to the next record. But since I have not defined which table to look in, how does it know where to look for the next record, or am I looking at the problem all wrong?
Anyways, I have copied and slightly modified code from the "Exploring Revolution: Work with Databases" tutorial to connect to a MySQL database, and I'm not having much success.
Code: Select all
local sDatabaseId
on preOpenStack
databaseConnect
-- Show the first available record:
goNext 0
if the result is not empty then
uiReset
end if
end preOpenStack
on databaseConnect
get revOpenDatabase("mysql", "(RunRev website)", "test", "example", "example")
if it is not an integer then
error "Could not connect to database:" && it
end if
put it into sDatabaseId
end databaseConnect
If I understand it correctly, goNext will go to the next record. But since I have not defined which table to look in, how does it know where to look for the next record, or am I looking at the problem all wrong?