Jump to content

Can't figure out error


timmah1

Recommended Posts

Why is this not working?

 

$order = "SELECT * FROM `order_notes` WHERE order = '4'";
$result = mysql_query($order);			   

$numberall = mysql_numrows($result);
if ($numberall==0) {
    echo "<strong>There are no notes for $row[f_name] $row[l_name]</strong>"; 
}
while($row = mysql_fetch_array( $result )){
$formatted_date = date("F j, Y", strtotime($row['date']));

 

I get this error

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/orderbal/public_html/admin/pages/notes.php on line 14
There are no notes for
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/orderbal/public_html/admin/pages/notes.php on line 18

Link to comment
https://forums.phpfreaks.com/topic/97215-cant-figure-out-error/
Share on other sites

and if you would have put this

<?php
$order = "SELECT * FROM `order_notes` WHERE order = '4'";
$result = mysql_query($order) or die ("error in query " . mysql_error());
//the "or die" bit would have told you that an error existed in the query and would have been easier to debug
// the other errors all stem from the fact that the query was in error, so no results resource to work with
?>

 

regards

Link to comment
https://forums.phpfreaks.com/topic/97215-cant-figure-out-error/#findComment-497431
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.