kelphyr Posted February 16, 2007 Share Posted February 16, 2007 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in,... $keyw=($_POST['keywords']); $sql = "SELECT * FROM items_db WHERE name_japanese LIKE '%$keyw%'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ ... i dont understand Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/ Share on other sites More sharing options...
hitman6003 Posted February 16, 2007 Share Posted February 16, 2007 Change: $result = mysql_query($sql); to $result = mysql_query($sql) or die(mysql_error()); And see what the error is. Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185954 Share on other sites More sharing options...
beaux1 Posted February 16, 2007 Share Posted February 16, 2007 Replace with: while($row = @mysql_fetch_array($result)){ Tell me if it works, I did for me when I got those problems before. Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185955 Share on other sites More sharing options...
hitman6003 Posted February 16, 2007 Share Posted February 16, 2007 Replace with: while($row = @mysql_fetch_array($result)){ Tell me if it works, I did for me when I got those problems before. That doesn't solve anything...it merely forces php to not display any errors. Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185956 Share on other sites More sharing options...
beaux1 Posted February 16, 2007 Share Posted February 16, 2007 Oh shit, I did that on my site. Runs fine but eh, maybe I should look into it. Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185957 Share on other sites More sharing options...
kelphyr Posted February 16, 2007 Author Share Posted February 16, 2007 oh it says my table doesnt exist, ill check this and tell you whats up with that brb Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185959 Share on other sites More sharing options...
kelphyr Posted February 16, 2007 Author Share Posted February 16, 2007 okok, i got it my table name had a letter more.. now it works yay Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185960 Share on other sites More sharing options...
trq Posted February 16, 2007 Share Posted February 16, 2007 There is nothing weird about this error considering you've made the mistake of not checking your query succeeded before trying to use it. The general syntax for a select query should always be at least... <?php $keyw=($_POST['keywords']); $sql = "SELECT * FROM items_db WHERE name_japanese LIKE '%$keyw%'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_array($result)) { // display data. } } // else no results found. } // else query failed. ?> Link to comment https://forums.phpfreaks.com/topic/38710-weird-error-with-mysqlmysql_fetch_array-supplied-argument-is-not/#findComment-185961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.