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']"; ?> 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); 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. 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 :-\ 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); 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
Archived
This topic is now archived and is closed to further replies.