timmah1 Posted March 21, 2008 Share Posted March 21, 2008 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 Quote Link to comment Share on other sites More sharing options...
papaface Posted March 21, 2008 Share Posted March 21, 2008 change: "SELECT * FROM `order_notes` WHERE order = '4'"; to "SELECT * FROM `order_notes` WHERE `order` = '4'"; Then change: mysql_numrows to mysql_num_rows See if that helps. Quote Link to comment Share on other sites More sharing options...
timmah1 Posted March 21, 2008 Author Share Posted March 21, 2008 Thanks. works perfect now!! Quote Link to comment Share on other sites More sharing options...
paul2463 Posted March 21, 2008 Share Posted March 21, 2008 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.