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!

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.