Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
---------------------------------------------
sendquery.php
---------------------------------------------
define("SQL_HOSTNAME", "myhost");
define("SQL_USERNAME", "myusername");
define("SQL_PASSWORD", "mypassword");
define("SQL_DATABASE", "mydatabase");
$logpath = "/path/to/a/writable/directory/errorlog.txt";
$exitMsg = "<p>Sorry, this utility is currently unavailable. Please <a href='mailto:webmaster@yoursite.com'>email the Webmaster</a> for more information.</p>";
function exitOut($logMsg,$logpath,$exitMsg) {
error_log($logMsg . chr(13) . chr(10), 3, $logpath);
echo $exitMsg;
exit();
}
if (isset($query)) {
if (!mysql_pconnect(SQL_HOSTNAME,SQL_USERNAME,SQL_PASSWORD)) exitOut(chr(10) . "Unable to connect to " . SQL_HOSTNAME,$logpath,$exitMsg);
if (!mysql_select_db(SQL_DATABASE)) exitOut(chr(10) . "Unable to select database '" . SQL_DATABASE,$logpath,$exitMsg);
if (!isset($queryname)) $queryname = "recordset";
if (!$$queryname = mysql_query($query)) exitOut(chr(10) . "Database query failed: " . $query,$logpath,$exitMsg);
}
else {
exitOut(chr(10) . "The 'query' variable was not passed to sendquery.php",$logpath,$exitMsg);
}
---------------------------------------------
yourfile.php
---------------------------------------------
$query = "SELECT * FROM mytable";
$queryname = "getInfo";
include "/your/directory/structure/sendquery.php";
while ($info = mysql_fetch_array($getInfo)) {
...
}