Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php / mysql help with new script

    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.

    ljb

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    PHP Code:
    $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>'
    }else{
       echo 
    'No messages found.';

    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •