Hi, I want to create a related post section on my dynamically generate page.
I'm trying to use Rand() to display just random records but it only displays "Resource id #4".
$result= mysql_query("SELECT COUNT(*) FROM news");
$total = mysql_result($result, 0, 0);
// create a random number
$number = mt_rand()%$total;
// get a random entry
$result= mysql_query("SELECT * FROM news LIMIT $number, 5");
This is what I'm using to generate the random post but nothing is pulling from the table.
I want it to show records that match a certain category. They all have an ID that I use name post_id = primary key, but I want it to check the article it's on by where it was pulled from since it was dynamically generated. Then scan that record for what category it came from then use that category to pull other random articles from that category and then have it display as a small picture, and use title for link. sorry if this isn't specific enough. if you need any more information or need illustrations i can show what i want. thanks.