ohdang888 Posted December 31, 2007 Share Posted December 31, 2007 hey. i'm trying to display "related" games. i have the start of a pretty simple code... i want to take the name of the game, and put it in a link, for example: a related game is located at "game.php?title=2deep" i want the link to just look like "2deep" heres my code. i knwo its wrong though because it not working. its not even coming up with an error, its just blank. (but i have data in my db) <?php $type = stripslashes($row['type']); $related_games = mysql_query("SELECT `title` FROM `game` WHERE `type`= '{$type}' ORDER BY RAND('title') LIMIT 10") or die(mysql_error()); while($row = mysql_fetch_array($related_games)){ echo '<a href="game.php?title='; echo $row[0]; echo '">'; echo $row[o]; echo '</a>'; echo '<br>'; } ?> the title put out by those two "$row[0]" needs to be the same title. Quote Link to comment https://forums.phpfreaks.com/topic/83909-why-isnt-query-working/ Share on other sites More sharing options...
revraz Posted December 31, 2007 Share Posted December 31, 2007 Probably have to use a mod rewrite in your .htaccess Quote Link to comment https://forums.phpfreaks.com/topic/83909-why-isnt-query-working/#findComment-427019 Share on other sites More sharing options...
ohdang888 Posted January 1, 2008 Author Share Posted January 1, 2008 how do i do that? p.s.- happy new year everyone! Quote Link to comment https://forums.phpfreaks.com/topic/83909-why-isnt-query-working/#findComment-427021 Share on other sites More sharing options...
sasa Posted January 1, 2008 Share Posted January 1, 2008 try <?php $type = stripslashes($row['type']); $related_games = mysql_query("SELECT `title` FROM `game` WHERE `type`= '{$type}' ORDER BY RAND('title') LIMIT 10") or die(mysql_error()); while($row2 = mysql_fetch_array($related_games)){ echo '<a href="game.php?title='; echo $row2[0]; echo '">'; echo $row2[0];//o<>0 echo '</a>'; echo '<br>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/83909-why-isnt-query-working/#findComment-427023 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.