Current location: Hot Scripts Forums » Programming Languages » PHP » Display mysql results on a table.


Display mysql results on a table.

Reply
  #1 (permalink)  
Old 12-15-09, 12:24 PM
martin_1988 martin_1988 is offline
New Member
 
Join Date: Dec 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Display mysql results on a table.

I'm currently working on a game site and I need to display the latest games added. But when I try to display the results I get the same results over and over.

Here is the code:
Code:
<?

$local ="";
$user =""; //Usuário do DataBase
$senha =""; //Senha do DataBase
$db =""; //DataBase

if($conectar = @mysql_connect($local,$user,$senha)) {
@mysql_select_db($db,$conectar) ;
}
else {
$error = mysql_error() ;
echo "No se pudo conectar a la base de datos por: <b>$error</b>" ;
}
$most = 10;
$sql4 = mysql_query("SELECT * FROM jogos order by id desc LIMIT 0,".$most);
$i = 0;
?>
<?
while($show = mysql_fetch_array($sql4))
{
$i++
?>
 <table width="100%"  border="0" cellspacing="0" class="menu">
<tr>
 <td width="124" align="center" valign="top" style="border-bottom:1px solid #B6A792;"><a href="<?= "gameen.php?id=".$show[id] ?>" title="<?= $show['jogo'] ?>"><img border="0" height="82" src="<?= $jogo->Screen; ?>" width="120"></a></td>
 <td valign="top" style="padding-left:4px;border-bottom:1px solid #B6A792;">
  <table width="100%" cellspacing="0" cellpadding="0" border="0">
   <tr>
    <td align="left"><a href="<?= "gameen.php?id=".$show[id] ?>"><b><?= $show['jogo'] ?></b></a></td>
    
    <td align="right" width="200">( <small><?= $show['date'] ?></small> )&nbsp;&nbsp;</td>
   </tr>
  </table>
  <div><b><a href="gameen.php?ano=<?= $jogo->ano; ?>"><?= $jogo->ano; ?></a></b>, <?= $jogo->empresa; ?></div>
  <div><a href="gameen.php?categoria=<?= $jogo->categoria; ?>"><?= $jogo->categoria; ?></a></div>
 </td>
</tr>
 </table><?
}?>
I need to display them all each row with it's unique information. Thanks!
Reply With Quote
  #2 (permalink)  
Old 12-15-09, 09:13 PM
martin_1988 martin_1988 is offline
New Member
 
Join Date: Dec 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Anyone? Thanks!
Reply With Quote
  #3 (permalink)  
Old 12-16-09, 06:46 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Post the output (text is fine) and explain why it isn't what you want.
Reply With Quote
  #4 (permalink)  
Old 12-16-09, 11:20 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
How does $jogo->Screen get it's value?
I would assume that for each record in the database you have an image file name stored.
And for each record that is displayed there is a different image file.
So why are you assigning $jogo->Screen to the src of each image element?
Shouldn't you be assigning the image file name from the database, to the image element, instead of $jogo->Screen?
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks

Tags
database, html, mysql, php, results


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display results of simple query? Tim Mousel PHP 1 07-25-08 12:13 PM
Display data in table + SQL OUTER JOIN query csv Database 4 03-15-08 06:11 AM
MYSQL display results Rayden Database 0 07-18-06 08:53 AM
Getting a function to return a MySQL table row.. Axe PHP 6 09-07-04 06:46 AM


All times are GMT -5. The time now is 08:05 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.