Hi - I have the following code on my site to retrieve some news threads from my database, it works fine except that it makes one mysql record become 2 posts on the main page. Now I've discovered that the problem is when I have two tables, which is what I need... here's how I realised:
[b]Works:[/b]
<?php
$result = mysql_query("SELECT * FROM news order by id desc limit 15")
or die("Failed to connect to the database.");
While ($row = mysql_fetch_array($result))
{
?>
<tr>
<td class="newstitle"><? echo $row['title']; ?></td>
</tr><tr>
<td class="main"><? echo $row['body']; ?></td>
</tr><tr>
<td class="newsfooter">Posted by: <i><a href="http://www.fateam.com/forum/profile.php?mode=viewprofile&u=<? echo $row['user_id']; ?>"><? echo $row['postby']; ?></a></i> on <? echo $row['date']; ?> </td>
</tr>
<?
}
mysql_free_result($result);
?>
[b]Need this one but doesn't work, notice that it has two tables in the "FROM" section:[/b]
<?php
$result = mysql_query("SELECT * FROM news, phpbb_users order by id desc limit 15")
or die("Failed to connect to the database.");
While ($row = mysql_fetch_array($result))
{
?>
<tr>
<td class="newstitle"><? echo $row['title']; ?></td>
</tr><tr>
<td class="main"><? echo $row['body']; ?></td>
</tr><tr>
<td class="newsfooter">Posted by: <i><a href="http://www.fateam.com/forum/profile.php?mode=viewprofile&u=<? echo $row['user_id']; ?>"><? echo $row['postby']; ?></a></i> on <? echo $row['date']; ?> </td>
</tr>
<?
}
mysql_free_result($result);
?>
I've been twiddling my thumbs, any ideas?
Thanks.