Jump to content

Trying to get data from 2 different tables to display on one page.


Xdega

Recommended Posts

I have been playing around with this. Thought I had it nailed, and then found that It was fubar when I started to add more entries to the database. I basically want to display 2 tables from my database on the page. One is called "players" the other is called "editlog".

 

The output with my current script came out as this:

fubary.jpg

 

and here is the dreaded code:

<html>
<body>

<u><h3>Performance Point Monitor (PPM): Knights of Shadow WoW Officers.</h3></u>
<?php
include('/home/a3269923/public_html/ppm/admin/config.php');
include('/home/a3269923/public_html/ppm/admin/dbopen.php');
$query="SELECT * FROM players";
$result=mysql_query($query);
$num=mysql_numrows($result);
?>
<table border="1" style="position:absolute;width:500;height:10;left:0;top:70">
<tr>
<th><font face="Arial, Helvetica, sans-serif">PLAYER</font></th>
<th><font face="Arial, Helvetica, sans-serif">POINTS</font></th>
<th><font face="Arial, Helvetica, sans-serif">DATE</font></th>
</tr>
<?php
$i=0;
while ($i < $num) {
$f2=mysql_result($result,$i,"PLAYER_NAME");
$f3=mysql_result($result,$i,"ND_POINTS");
$f4=mysql_result($result,$i,"DATE ADDED");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
</tr>
</table>

<?php
$i++;
}
?>
<?php
include('/home/a3269923/public_html/ppm/admin/config.php');
include('/home/a3269923/public_html/ppm/admin/dbopen.php');

//USER LOG
$query="SELECT * FROM editlog";
$result=mysql_query($query);
$num=mysql_numrows($result);
?>
<table border="1" style="position:absolute;width:600;height:10;left:510;top:70">
<tr>
<th><font face="Arial, Helvetica, sans-serif">USER</font></th>
<th><font face="Arial, Helvetica, sans-serif">TYPE</font></th>
<th><font face="Arial, Helvetica, sans-serif">POINTS</font></th>
<th><font face="Arial, Helvetica, sans-serif">NOTES</font></th>
<th><font face="Arial, Helvetica, sans-serif">DATE</font></th>
</tr>

<?php
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"USER");
$f2=mysql_result($result,$i,"TYPE");
$f3=mysql_result($result,$i,"POINTS");
$f4=mysql_result($result,$i,"NOTE");
$f5=mysql_result($result,$i,"TIMESTAMP");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>
</tr>
</table>

<?php
$i++;
}
?>

 

 

What am I doing wrong? Halp!

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.