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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. ?> 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.