Page 1 of 1
I need to create a custom MySQL app - can I use LiveCode?
Posted: Mon Aug 11, 2014 8:30 pm
by karmacomposer
Simply put, can LiveCode be used to access MySQL databases and perform database functions - like adding up all fields to get a value (queries).
Thank you for your answer. I do have SQL Yoga, but not sure if it works with the newest version of LiveCode.
Mike
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 8:59 pm
by karmacomposer
I found a MySQL LiveCode tutorial. I entered this onto a button script:
Code: Select all
on mouseUp
-- use a global variable to hold the connection ID so other scripts can use it
global gConnectionID
-- set up the connection parameters - edit these to suit your database
put "tampaschooloutfitters.com" into tDatabaseAddress
put "frankg_gccasshopdb" into tDatabaseName
put "frankg_username" into tDatabaseUser
put "xxxxxxxxxx" 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
end mouseUp
It does not connect properly. Normally, I would use localhost as the server host, but this is running as an app and not on the web, so how do I connect to the database and get a successful connection? I am on a solid wifi connection, so i do have internet. I also have the connection details (username, password, database name, domain, etc). Not sure what I am doing wrong.
Obviously, I did not put the actual password, as this is a client database. Also, username is incorrect on purpose. For added security, I did not put the actual username either. In the actual script, all database login details are accurate.
Mike
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 9:20 pm
by karmacomposer
One problem I see is that the password to the database has a " in it. How do I format the password to account for the " symbol?
For example, the code is something like:
Code: Select all
put "eeY23"g4dfB" into tDatabasePassword
(no, this is not the actual password)
Note the " in the password. How do I format this properly so it works?
Mike
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 9:35 pm
by karmacomposer
I figured out that putting "aaaa" & quote & "bbbb" would result in "aaaa"bbbb".
Hence,
Code: Select all
put "eeY23" & quote & "g4dfB" into tDatabasePassword
should be the correct string.
Is this accurate?
Doing it still resulted in no access to the database. I KNOW the other info is all correct.
Mike
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 9:36 pm
by sefrojones
Try this:
Code: Select all
put "eeY23""e&"g4dfB" into tDatabasePassword
--Sefro
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 9:37 pm
by karmacomposer
sefrojones wrote:Try this:
Code: Select all
put "eeY23""e&"g4dfB" into tDatabasePassword
--Sefro
I did. No love.
What am I doing wrong?
Mike
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 9:50 pm
by karmacomposer
Again, the server that hold the database is online at
www.tampaschooloutfitters.com
Is there a special procedure for that? Do I need to make some kind of exception on the server for my local IP?
Mike
Re: I need to create a custom MySQL app - can I use LiveCode
Posted: Mon Aug 11, 2014 9:59 pm
by karmacomposer
I got it. I had to add my IP address to the web host to accept my connection.
Thanks for your help.
Mike