RE: php & mysql prob...
| From: | Tim Ward | Date: | Wed, 31 Oct 2001 09:30:07 +0000 |
| Subject: | RE: php & mysql prob... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72995@lists.php.net to get a copy of this message | ||
Your query is invalid, hence $test is false rather than a result set. I
usually do if ($test = mysql_db_query( ... )) to trap this. Don't put quotes
around table or field names, in your case 'Port$p' should be just Port$p and
'Port$p'.date just Port$p.date.
Tim
----------
From: sc [SMTP:sven@gstar.com.au]
Sent: 31 October 2001 00:56
To: php-general@lists.php.net
Subject: php & mysql prob...
Hi;
i keep getting an error of: Warning: Supplied argument is not a
valid MySQL
result resource in /datascripts/insertdata.php on line 17...
Line 17 is: $row = mysql_fetch_assoc($test);
and here is the rest of it (not all of it though):
for ($p = 1; $p <= 24; $p++) {
$test = mysql_db_query("melbourne", "SELECT * FROM 'Port$p' WHERE
'Port$p'.date='$yesterday'");
$row = mysql_fetch_assoc ($test);
$yindata = $row['switchin'];
$youtdata = $row['switchout'];
$dinPort = '$inPort$p' - $yindata;
$doutPort = '$outPort$p' - $youtdata;
Can anyone help me overcome this prob? i've prob missed something
without
thinking but i cant seem to get it...
Thx.
sc