chris_2001 Posted August 5, 2008 Share Posted August 5, 2008 I have been looking at it for about 20mins and I must be missing something because I can't see what is wrong with it :/ Anyone know why the query is failing? mysql_fetch_array(): supplied argument is not a valid MySQL result resource in test.php on line 12 <?php include "config.php"; mysql_connect("$host", "$username", "$password"); mysql_select_db("$db_name"); $query = "SELECT OrderNum FROM ordernum"; $result = mysql_query($query); $row = mysql_fetch_array($query, MYSQL_ASSOC); $OrderNum = "row['OrderNum']"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/118283-solved-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/ Share on other sites More sharing options...
lemmin Posted August 5, 2008 Share Posted August 5, 2008 $row = mysql_fetch_array($result, MYSQL_ASSOC); Quote Link to comment https://forums.phpfreaks.com/topic/118283-solved-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-608684 Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 To elaborate: The query wasn't failing, you were just using the physical query string as opposed to the result set. Quote Link to comment https://forums.phpfreaks.com/topic/118283-solved-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-608691 Share on other sites More sharing options...
chris_2001 Posted August 5, 2008 Author Share Posted August 5, 2008 Thx ahaha i am kind of stupid today i guess :-\ Quote Link to comment https://forums.phpfreaks.com/topic/118283-solved-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-608694 Share on other sites More sharing options...
.josh Posted August 5, 2008 Share Posted August 5, 2008 btw, doing $row = mysql_fetch_array($result, MYSQL_ASSOC); is the exact same as doing $row = mysql_fetch_assoc($result); Quote Link to comment https://forums.phpfreaks.com/topic/118283-solved-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-608699 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.