Jump to content

why isn;t this working?


ohdang888

Recommended Posts

the link won't so show up

 

$new_games = mysql_query("SELECT link, game_picture_url, type, counter FROM game ORDER BY counter LIMIT 10")
or die(mysql_error());  

while($row2 = mysql_fetch_assoc($new_games)){       
   echo '<td>';
   echo'<center>';
   echo '<font size=3>';
   echo '<img src="gamepic/';
   echo $row2['game_picture_url'];
   echo '" height="120" width="120"><br>';
?>
<a href="game.php?title=
<?php
   echo $row2['title'];
?>
">
<?php
   echo $row2['title'];
   echo '</a>';
   echo '<br>';
   echo '<font size=2>';
   echo '(';
   echo $row2['type'];
   echo ')';
   echo '</td>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/84353-why-isnt-this-working/
Share on other sites

Try this:

 

$new_games = mysql_query("SELECT link, game_picture_url, type, counter FROM game ORDER BY counter LIMIT 10")
or die(mysql_error());  

while($row2 = mysql_fetch_assoc($new_games)){       
  extract($row2);
   echo '<td>';
   echo'<center>';
   echo '<font size=3>';
   echo '<img src="gamepic/';
   echo "$game_picture_url";
   echo '" height="120" width="120"><br>';
   echo '<a href="game.php?title='.$title.'">';
   echo "$title";
   echo '</a>';
   echo '<br>';
   echo '<font size=2>';
   echo '(';
   echo "$type";
   echo ')';
   echo '</td>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/84353-why-isnt-this-working/#findComment-429644
Share on other sites

first off why you breaking out of php to type an agref?

secondly clean it up

thirdly check for rows like this

<?php
$new_games ="SELECT link, game_picture_url, type, counter FROM game ORDER BY counter LIMIT 10";
$result = mysql_query($new_games) or die(mysql_error()."<br />".$new_games);
if(mysql_num_rows($result)>0){
while($row2 = mysql_fetch_assoc($result)){       
	echo "<td>";
	echo "<center>";
	echo "<font size=\"3\">";
	echo "<img src=\"gamepic/."$row2['game_picture_url']." height=\"120\" width=\"120\" />";
	echo "<br />";
	echo "<a href=\"game.php?title=".$row2['title']."\" >";
		echo $row2['title'];
	echo "</a>";
	echo "<br />";
	echo "<font size=\"2\">";
	echo "(".$row2['type'].")";
	echo "</td>";
}
}
else{
echo "No Results Found.";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/84353-why-isnt-this-working/#findComment-429647
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.