yea, you can use the same code that you are just take out the while loop I
do it all the time.

Thank you
Brian Paulson
Sr. Web Developer

-----Original Message-----
From: olinux [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 12, 2001 10:58 AM
Subject: [PHP-DB] must I "while" loop

OK, if I am extracting a row from a mysql DB where I know that there is only
ONE row:

$result = "SELECT company, fname, lname FROM table_name WHERE id = \"$id\"

I am should be able to use the variables right away... at least I would
think so, I don't think I should have to run through a whileloop and create
an array. But to make it work I had to.

while ($row = mysql_fetch_array($result)) {

$company = $row['company'];
$fname = $row['fname'];
$lname = $row['lname'];

$contact_info .= "$company $fname $lname";

So my question, shouldn't I be able to use the variables $company $fname
$lname before the WHILE loop since I know that there is only one record?


PHP Database Mailing List (
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