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.
echo "<pre>".print_r($session, true) . "</pre>";
$result= mysql_query($query);
if ($result === false){
echo "error with query. <br/>error was " . mysql_error() . " <br/>Query was: $query<br/>"
exit;
}
function displayVendorInfo(){
global $database;
$q = "SELECT coName,coStreet,coUnit,coCity,coStProv,coType,pack FROM vendors WHERE coCity = '".mysql_real_escape_string($session->userinfo['city'])."' AND coStProv = '".mysql_real_escape_string($session->userinfo['stProv'])."'";
$result = $database->query($q);
/* Error occurred, return given name by default */
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo "Error displaying info";
return;
}
if($num_rows == 0){
echo "error with query. <br/>error was ".mysql_error()." <br/>Query was:$q<br/>";
return;
}
/* Display table contents */
echo "<table align=\"left\" cellspacing=\"0\" cellpadding=\"3\" width=\"750\">\n";
echo "<tr><td><b>Company Name</b></td><td><b>Company Address</b></td><td><b>Unit Number</b></td><td><b>City</b></td><td><b>State / Province</b></td><td><b>Company Type</b></td><td><b>Package Available</b></td></tr>\n";
for($i=0; $i<$num_rows; $i++){
$coname = mysql_result($result,$i,"coName");
$coaddress = mysql_result($result,$i,"coStreet");
$counit = mysql_result($result,$i,"coUnit");
$cocity = mysql_result($result,$i,"coCity");
$coStProv = mysql_result($result,$i,"coStProv");
$coType = mysql_result($result,$i,"coType");
$coPack = mysql_result($result,$i,"pack");
echo "<tr><td>$coname</td><td>$coaddress</td><td>$counit</td><td>$cocity</td><td>$coStProv</td><td>$coType</td><td>$coPack</td></tr>\n";
}
echo "</table><br>\n";
}
?>
Session Object
(
[fName] =>
[lName] =>
[street] =>
[apt] =>
[city] =>
[stProv] =>
[country] =>
[pc] =>
[phone] =>
[username] => me
[userid] => 993cbe7b590e2b60950c3c48ce389502
[userlevel] => 9
[time] => 1248455295
[logged_in] => 1
[userinfo] => Array
(
[0] => me
[fName] => me
[1] => me
[lName] => me
[2] => 215 my st
[street] => 215 my st
[3] =>
[apt] =>
[4] => Waterloo
[city] => Waterloo
[5] => ON
[stProv] => ON
[6] => Can
[country] => Can
[7] => N2L 1t3
[pc] => N2L 1t3
[8] => 123 456 7890
[phone] => 123 456 7890
[9] => me
[username] => me
[10] => 5447c93bcfce3951f4b065c5fd833551
[password] => 5447c93bcfce3951f4b065c5fd833551
[11] => 993cbe7b590e2b60950c3c48ce389502
[userid] => 993cbe7b590e2b60950c3c48ce389502
[12] => 9
[userlevel] => 9
[13] => me@gmail.com
[email] => me@gmail.com
[14] => 1248454396
[timestamp] => 1248454396
)
[url] => /login/promotions.php
[referrer] => /login/main.php
)
function myfunction ($myvar){
...
}
...
myfunction($session);
$result = $database->query($q);
/* Error occurred, return given name by default */
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo "Error displaying info";
return;
}
if($num_rows == 0){
echo "error with query. <br/>error was ".mysql_error()." <br/>Query was:$q<br/>";
return;
}
$result = $database->query($q);
if($result === false ) {
echo "error with query. <br/>error was ".mysql_error()." <br/>Query was: $q<br/>";
return;
}
global $database, $session;