Jump to content

problem with ids and page content


thetoolman

Recommended Posts

Hi there,

 

I have a simple php script which displays the latest entries.

 

I can insert them into the database and select the titles, however, they all seem to be going to the same post even though the id is different.

 

For example,

id?=5

id?=6

id?=7 etc

will all go to the same page instead of going to the actual id.

 

This is my code:

 

$sql = "select * from categories, entries where entries.cat_id = categories.id order by dateposted desc limit 10";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
echo "<h1><a href='view_entry.php?id=" . $row['id'] . "'>" . $row['subject'] . "</a></h1><br />";

 

Does anyone have any ideas what I have wrong?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/137338-problem-with-ids-and-page-content/
Share on other sites

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.