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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.