Hey All,
I'm a newbie and I'm getting the same Warning message:
Warning: Supplied argument is not a valid MySQL result resource in /home/sites/site190/web/test01.php on line 45
Warning: Supplied argument is not a valid MySQL result resource in /home/sites/site190/web/test01.php on line 53
Warning: Supplied argument is not a valid MySQL result resource in /home/sites/site190/web/test01.php on line 69
<?php
// Set the variables for the database access:
$Host = "localhost";
$User = "username";
$Password = "password";
$DBName = "databasename";
$TableName = "Stratosphere";
$CheckIn = "09/01/2002";
$CheckOut = "09/05/2002";
$Link = mysql_connect ($Host, $User, $Password);
$Query = "SELECT from $TableName WHERE (Dates = '$CheckIn')";
$Query01 = "SELECT from $TableName WHERE (Dates = '$CheckOut')";
$Query02 = "SELECT Price FROM $TableName WHERE (Dates BETWEEN '$CheckIn' AND '$CheckOut')";
$Result = mysql_db_query ($DBName, $Query, $Link);
$Result01 = mysql_db_query ($DBName, $Query01, $Link);
$Result02 = mysql_db_query ($DBName, $Query02, $Link);
// Create a table.
print ("<TABLE BORDER=1 WIDTH=\"20%\" CELLSPACING=1 CELLPADDING=1 ALIGN=LEFT>\n");
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>Price</TD>\n");
print ("</TR>\n");
// Fetch the results from the database.
while ($Row = mysql_fetch_array ($Result)) {
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[Price]</TD>\n");
print ("</TR>\n");
print "<p>Check In Day: $$Row[Price].00<br></p>\n";
}
// Fetch the results from the database01.
while ($Row = mysql_fetch_array ($Result01)) {
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[Price]</TD>\n");
print ("</TR>\n");
print "<p>Check Out Day: $$Row[Price].00<br></p>\n";
}
print ("</TABLE>\n");
// Create a table.
print ("<TABLE BORDER=1 WIDTH=\"20%\" CELLSPACING=1 CELLPADDING=1 ALIGN=LEFT>\n");
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>Price</TD>\n");
print ("</TR>\n");
while ($Row = mysql_fetch_array ($Result02)) {
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[Price]</TD>\n");
print ("</TR>\n");
}
print ("</TABLE>\n");
$a = array($Query02);
echo "sum(a) = ".array_sum($a)."\n";
mysql_close ($Link);
?>
I have this working fine on my computer testing environment, IIS 5.0 , PHP 4.21.
But when I upload it to my web host I get the Warnings.
I can see that they are using PHP 4.12, I'm not sure if that makes a difference.
thanks for any help.