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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.