View Full Version : php / mysql help with new script

04-11-2004, 06:15 AM
What i'm aiming for is a mysql driven database script that will allow clients to post an anonymous comment in the database and then give them a random link to that comment. So this random link is like /comment.php?=687687 or something like that.

I'm not sure if there is a function in php that does that or even how to go about starting it... I'm kinda new to php and just looking for help.

thanks alot.


04-11-2004, 11:44 AM
This is kind of a general question and involves more then a few ines of code + how to do it is cvery application-specific. What always will be envolved is inserting the post into a table with an autonum primary key --< it's this value that is appended to the querystring.

To build the links, you select this records PK value and append it. like

$sql="select messageID, messageTitle from messages";
$result=mysql_query($sql) or die ('Queryproblem');
if (mysql_num_rows($result) >=1){
while ($row=mysql_fetch_assoc($resukt)){
echo '<a href="yourpage.php?message=' . $row['messageID'] . '>open message "'. $row['messageTitle'] .'"</a>';
echo 'No messages found.';