Hi,
I’m a newbie to both Lua and Corona SDK. I’ve been building a Java application that interacts with a MySQL database. Well as it turns out, I may have to move to the mobile platform arena. Therefore, I’ve been trying to get familiar with Lua programming and the Corona SDK environment. I like to learn by example so I was wondering if there is a simple example of a program that connects to and lists the rows of a table in a MySQL database from within the Corona SDK environment.
I can run the following program from the command line and it works. If I try from within a Corona SDK project, it doesn’t work (it can’t find the luasql.mysql module):
require "luasql.mysql";
env = assert((luasql.mysql()), "Uh oh, couldn't load driver")
conn = assert(env:connect("database","username","password","localhost"), "Oops!!")
cur = assert (conn:execute ("SELECT \* from table\_1" ))
row = cur:fetch ({}, "a")
while row do
print ("\n------ new row ---------\n")
table.foreach (row, print)
row = cur:fetch (row, "a")
end
cur:close()
conn:close()
env:close()
Particulars:
I downloaded and install Lua from luaforwindows (http://code.google.com/p/luaforwindows/)
I running on a Windows 7 machine.
Thanks times infinity for any help/suggestions
Bill
[import]uid: 173103 topic_id: 30562 reply_id: 330562[/import]