I need to create a custom MySQL app - can I use LiveCode?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
I need to create a custom MySQL app - can I use LiveCode?
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
Thank you for your answer. I do have SQL Yoga, but not sure if it works with the newest version of LiveCode.
Mike
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: I need to create a custom MySQL app - can I use LiveCode
I found a MySQL LiveCode tutorial. I entered this onto a button script:
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
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
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
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: I need to create a custom MySQL app - can I use LiveCode
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: (no, this is not the actual password)
Note the " in the password. How do I format this properly so it works?
Mike
For example, the code is something like:
Code: Select all
put "eeY23"g4dfB" into tDatabasePassword
Note the " in the password. How do I format this properly so it works?
Mike
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: I need to create a custom MySQL app - can I use LiveCode
I figured out that putting "aaaa" & quote & "bbbb" would result in "aaaa"bbbb".
Hence,
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
Hence,
Code: Select all
put "eeY23" & quote & "g4dfB" into tDatabasePassword
Is this accurate?
Doing it still resulted in no access to the database. I KNOW the other info is all correct.
Mike
Last edited by karmacomposer on Mon Aug 11, 2014 9:36 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: I need to create a custom MySQL app - can I use LiveCode
I did. No love.sefrojones wrote:Try this:
Code: Select all
put "eeY23""e&"g4dfB" into tDatabasePassword
--Sefro
What am I doing wrong?
Mike
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: I need to create a custom MySQL app - can I use LiveCode
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
Is there a special procedure for that? Do I need to make some kind of exception on the server for my local IP?
Mike
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: I need to create a custom MySQL app - can I use LiveCode
I got it. I had to add my IP address to the web host to accept my connection.
Thanks for your help.
Mike
Thanks for your help.
Mike