Hi all.  I am very new to this, and have been reading my way through php, but have 
come accross a stumbling block that I just don't seem able to get past, although I'm 
sure it's something simple.

I have a very basic mysql database set up, that contains a table with 4 fields- type, 
manname, manlink, and recordno

What I need to do is pull all records from the database, and provide a list on a page 
with links to the url's stored in manlink with the lable manname.  So far, I've come 
up with the script at the end of this message.  This script works beautifully for me- 
for the first record.  Could anyone point out why it won't go on to any other records?

Thanks, 

Newbie Bill


<?php
    /* Connecting, selecting database */
    $link = mysql_connect("192.168.0.112", "root", "")
        or die("Could not connect");
    print "Connected successfully";
    mysql_select_db("dgdrivers") or die("Could not select database");

    /* Performing SQL query */

    $getlength = "select * from man_links";
    $length = mysql_query($getlength);
    $idl = count($length);

    for ($id = 1 ;; $id++ ) {
                if ($id > $idl) {
                        break;
                }


    $query = "SELECT type, manname, manlink FROM man_links WHERE recordno=$id";
    $result = mysql_query($query) or die("Query failed");

    extract(mysql_fetch_array($result));

    /* Printing results in HTML */
    print "<table>\n";
    print "<p><a href=$manlink>$manname</a>";
    print "</table>\n";

}
    /* Free resultset */
    mysql_free_result($result);

    /* Closing connection */
    mysql_close($link);
?>

Reply via email to