PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$queryg = "SELECT * FROM games WHERE game_title LIKE '%'$game_search'%' ORDER BY `game_title` ASC";
$mysql_stuff = mysql_query($queryg, $mysql_link);
while($roc = mysql_fetch_row($mysql_stuff)){
$gameID = $rocї0];
$game_title = $rocї1];
$system = $rocї2];
print("<tr><td><div align="center">$system</div></td>");
print("<td><div align="center"><a href="editagame.php?gameID=$gameID" target="main">$game_title</a></div></td></tr>");
}
I want this search to be really easy to use. If there are 10 games with Tom Clancy in the title and they search for 'tom' (no quotes) then it will bring any game with tom in the name.
This gives me an error like: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/home/virtual/bolt3.com/webroot/htdocs/admin.bolt3.com/editagame-searchres.php on line 29
Ok that fixes my error output but it doesn't display anything. I guess it assumes there are none but I can clearly see in my game database that there are 2 games with Tom in the title and I am searching under the string tom.
How do I make my search , well search for the terms 'tom' in the game_title table?
EDIT: Actually I typed the exact name in the search and it didn't pull it up either. So I guess something is wrong somewhere. :S
Do an echo $queryg; and run the output/query directly in a mysql prompt (or phpMyAdmin etc) and see if it returns results. If it does then the problem is in the rest of the code, if it doesn't, then the query is at fault.