Thanks Gerry!

That's just what I was after. When query result data is returned to the 
LiveCode iOS app, is it returned in the same format as if the query was done in 
LiveCode? For example:

Id1 songblue 3:00
Id2 songred   2:45
Id3 song green 2:53

...

Essentially will I be able to put the query result in a variable and then 
manipulate it by line like normal in LiveCode (iOS)?

Thank You!

Sent from my iPad

On Jul 8, 2011, at 11:24 PM, Gerry Orkin <gerry.or...@gmail.com> wrote:

> John
> 
> MySQL is supported in LC on iOS. However tapping in to MySQL databases from 
> mobile devices introduces a bunch of access and security issues, so rather 
> than using the MySQL commands I use .php files on my MySQL server to do my 
> SELECTs and INSERTs. I run them from my iOS app using url http calls.
> 
> For example, from my app I call:
> 
> function sqlGetSongsOnServer
>    return  url ("http://somedomain.com/somedirectory/songs.php";)  
> end sqlGetSongsOnServer
> 
> On the server side, the songs.php looks like this:
> 
> <?
> // script to return number of songs
> 
> // connection information
> $hostName = "localhost";
> $userName = "whatever";
> $password = "blahblahblah";
> $dbName = "mediadb";
> 
> // make connection to database
> mysql_connect($hostName, $userName, $password) or die("Unable to connect to 
> host $hostName");
> 
> mysql_select_db($dbName) or die( "Unable to select database $dbName"); 
> 
> // return all the songs sorted by songnumber field
> $query = " SELECT * FROM  `songs` ORDER BY  `songs`.`songnumber`";
> $result = mysql_query($query);
> 
> // Determine the number of songs
> $number = mysql_numrows($result);
> 
> // Print the songs for return to LC
> for ($i=0; $i<$number; $i++) {
>     $songtitle = mysql_result($result,$i,"songtitle");
>     $filesize = mysql_result($result,$i, "filesize");
>        $desc = mysql_result($result,$i, "desc");
>     print "$songtitle\t$filesize\t$desc\n";
> }
> 
> // Close the database connection
> mysql_close();
> ?>
> 
> 
> 
> Cheers
> 
> Gerry
> 
> 
> 
> 
> On 09/07/2011, at 2:39 PM, JOHN PATTEN wrote:
> 
>> Hi All!
>> 
>> I have a little stack I'm testing some ideas out on. It makes some simple 
>> SELECT and INSERT mySQL queries using the LiveCode calls. It is my 
>> understanding that those LiveCode mySQL calls do not work in iOS.
>> 
>> Is it possible to to still access a mySQL database from with in iOS (in 
>> LiveCode)? If the answer is yes, how would I go about doing that in the best 
>> way?
>> 
>> Thank you!
>> 
>> John Patten
>> SUSD
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to