hello andreas hello all
is it possible to communicate with mysql on a server
from hollywood 5 ?
regards
hollywood 5 and my sql ?
Re: hollywood 5 and my sql ?
Hi stefff285,
Yes, write a php file as normal that expects a list or parameters through the URL.
Quick example:
servername .. "http://www.example.com/"
data$, count = DownloadFile(servername .. "addphone.php?fullname=Fred+Bloggs&phone=0123456789", { File = "T:logfile" })
data$ = nil
OpenFile(1, "T:logfile")
ReadLine(1) ; skip blank line
result$ = ReadLine(1)
debugprint(result$)
>>> echos OK or FAIL
Yes, write a php file as normal that expects a list or parameters through the URL.
Quick example:
servername .. "http://www.example.com/"
data$, count = DownloadFile(servername .. "addphone.php?fullname=Fred+Bloggs&phone=0123456789", { File = "T:logfile" })
data$ = nil
OpenFile(1, "T:logfile")
ReadLine(1) ; skip blank line
result$ = ReadLine(1)
debugprint(result$)
>>> echos OK or FAIL
Code: Select all
// addphone.php
if (isset ($_GET['fullname'])) { $fullname = htmlentities($_GET['fullname']); }
if (isset ($_GET['phone'])) { $phone = htmlentities($_GET['phone']); }
// mysql settings
$database="database_name";
$username="root";
$password="root";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$sql = "SELECT * FROM `table_name` WHERE `Fullname` = '$fullname'";
$result=mysql_query($sql) or die(mysql_error);
$num=mysql_numrows($result);
if ($num == 0) // this person not found, add to database
{
$sql = "INSERT INTO `$database`.`table_name` (`Fullname`, `Telephone`) VALUES ( '" . $fullname . "','" . $phone . "' );";
$result=mysql_query($sql) or die(mysql_error);
mysql_close();
echo "OK";
}
else
{ echo "FAIL"; }
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
http://myevolve.wordpress.com
Re: hollywood 5 and my sql ?
Can't edit post above, couple corrections:
1st line: change .. to = obviously ^.^
2nd line: Change the plus between Fred and Bloggs to a space character as DownloadFile() will complain.
1st line: change .. to = obviously ^.^
2nd line: Change the plus between Fred and Bloggs to a space character as DownloadFile() will complain.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
http://myevolve.wordpress.com
Re: hollywood 5 and my sql ?
hello hello
thanx a lot for reply
this kind of feature will take a long time before i will need it
but cool to see what is possible or not
thanx yet
regards
stephane
thanx a lot for reply
this kind of feature will take a long time before i will need it
but cool to see what is possible or not
thanx yet
regards
stephane