http://www.php.net/manual/en/function.mysql-fetch-object.php

Modified example from the manual above...

<?php 
mysql_connect ($host, $user, $password);
$result = mysql_db_query ("database", "select * from table");
while ($row = mysql_fetch_object ($result)) {
        // save database fields into variables here
        $user_id = $row->user_id;
        $name = $row->name;
        // print them out if you want, or store them in an array to return
if this is a function
        print ("<a href=user_details.php?user_id=$user_id>$name</a><br>\n");
}
mysql_free_result ($result);
?>

-Ben



-----Original Message-----
From: SED [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 16, 2001 5:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL - How to transfer a query resault into a variable?


Hi,

Lets say I have columns e.g.

        | name | address | phone |

I want to make a list of all the names and put the result into a HTML page
where each name is a link.

When the name is clicked (the link), it will open another HTML page with
full information (name, address and phone).

I know how to send the query to list the names (and into a formatted
HTML-file), but I don't know how to put each name into a variable or a link
for the next step.

Can you point me to functions I should focus at or even a solution?

Regards,
Sumarlidi Einar Dadason

SED - Graphic Design

------------------------------------------
Phone:       (+354) 4615501
Mobile:      (+354) 8960376
Fax:         (+354) 4615503
E-mail:      [EMAIL PROTECTED]
Homepage:    www.sed.is <- New Homepage!
------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to