Forum Moderators: coopster
What I am trying to do now is retrieve that data and give each post its own unique url (For example, one post could have the url http://www.example.com/showresults.php?id=249). If one was to go to that link, they would see a specific post and that url would be unique to that post. I understand that you have to use variables but I don’t quite get how I would go about doing this. Any help would be greatly appreciated.
$query = mysql_query("SELECT post FROM posts_table WHERE id='$_GET[id]'");
$row = mysql_fetch_assoc($query);
echo $row['post'];
?>
That should do it assuming that is what you named your fields. Just place it in the results page and it should work. Just change it around to match your layout and what not.
One piece of advice in that query example ... ALWAYS edit/escape user-supplied data. I would edit check it first to be certain it contains exactly what you expect, an integer value. I then run it through the mysql_real_escape_string [php.net] for good measure.