foreverhex Posted March 28, 2008 Share Posted March 28, 2008 I don't know if its because Im tired or something but I seem to be over looking something. Could some one please help... I think I just lost all sanity. I keep getting Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ...shop.php on line 102 This is a normal error, so I go back to see if somethings wrong with my coding in SQL and I can find it. Here is the code <?php //There is other crap before this that in theory shouldn't matter. elseif ($_GET[action] == 'close') { //First get the order and make it nice and viewable include 'rhf_db.php'; mysql_select_db('rhf_orders') or die('Could not select database'); $dbnum = $_SESSION[number]; $sql_getord = ("SELECT * FROM $dbnum WHERE status = 'open' ORDER BY date DESC") or die("Error getting order: " . mysql_error()); $sqlnum = '0'; while ($row_getorder = mysql_fetch_array($sql_getord)) { $preorder = $preorder . $row_getorder[item][$sqlnum] . ' | ' . $row_getorder[quantity][$sqlnum] . '<br>'; $sqlnum++; } echo 'preorder: <br><br>' . $preorder; ?> Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/98271-mysql-fetch-array-error-driving-me-batty/ Share on other sites More sharing options...
zenag Posted March 28, 2008 Share Posted March 28, 2008 try this... sql_getord = mysql_query("SELECT * FROM $dbnum WHERE status = 'open' ORDER BY date DESC") Link to comment https://forums.phpfreaks.com/topic/98271-mysql-fetch-array-error-driving-me-batty/#findComment-502846 Share on other sites More sharing options...
benjaminbeazy Posted March 28, 2008 Share Posted March 28, 2008 $sql_getord = mysql_query("SELECT * FROM $dbnum WHERE status = 'open' ORDER BY date DESC") or die("Error getting order: " . mysql_error()); Link to comment https://forums.phpfreaks.com/topic/98271-mysql-fetch-array-error-driving-me-batty/#findComment-502849 Share on other sites More sharing options...
foreverhex Posted March 28, 2008 Author Share Posted March 28, 2008 OMG! all apologizes... I am so tired, wow, I have been programing with php for 4 years and I forget and then over look that. wow I am so ashamed. Link to comment https://forums.phpfreaks.com/topic/98271-mysql-fetch-array-error-driving-me-batty/#findComment-502850 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.