Closed Thread
Results 1 to 2 of 2

Thread: A MySQL doubt

  1. #1
    Member AndreVR is an unknown quantity at this point
    Join Date
    Feb 2001
    Location
    127.0.0.1
    Posts
    48

    Question A MySQL doubt

    Sorry, I'm a newbie programming in PHP/MySQL....

    I have a table, with two columns called "id" and "nick"
    i'd like to make my PHP page to get all "nick" values and show them, and I'd like each one linking with <a href="www.hostingservice.com/phpscript?id=x>, where 'X' is the id correspondent stored in the MySQL table.

    I have two questions:
    1 - What SQL query should I do? (SELECT nick, id FROM $table)?

    2 - After the query, what code, should I write for the PHP page showing this correctly?

    Thanks....
    Sign here: x_______________

  2. #2
    FWS Addict megapuzik is an unknown quantity at this point megapuzik's Avatar
    Join Date
    Dec 2001
    Location
    Israel
    Posts
    694
    Well...
    the query for selecting the NICK is this :
    PHP Code:
    $query "SELECT nick FROM table_name";
    $result mysql_query($query$connection_link); 
    To show your results try this :
    PHP Code:
    $show_query "SELECT * FROM table_name";
    $handler mysql_query($show_query$connection_link);
    while(
    mysql_fetch_array($handler))
    {
    print 
    " <a href=\"www.hostingservice.com/phpscript?id=$handler[id]\">$handler[nick]</a>";

    good luck.
    -

Closed Thread

Bookmarks

Posting Permissions

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