Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2007
    Posts
    2,941
    Tokens
    0

    Latest Awards:

    Default How would i do this ?

    Ok i suck at php and all that but how would i do this.

    What i want to do is pull a random link out of a database and show it on a page.

    ok first how would i put the enterys on the database.2nd what would be the code to show it and 3rd how would i display it on the page would i need a iframe ect ?

    + rep for help
    Thanks
    Dan

  2. #2
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    To insert,
    Code:
    <?php
    // db connect info including database select
    mysql_query("insert into links(linkname, link) VALUES ('somelinkname', 'http://example.com/somelink.php')" or die(mysql_error());
    ?>
    to select..

    Code:
    <?php
    
    //conector info etc
    
    and to select and view
    $result = mysql_query("SELECT * FROM links") or die(mysql_error());
    $row = mysql_fetch_array($result);
    echo "<a href='";
    echo "$row[link]";
    echo "'>";
    echo $row['linkname'];
    echo "<a/>
    ?>
    How could this hapen to meeeeeeeeeeeeeee?lol.

Posting Permissions

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