RE: [PHP-DB] must I "while" loop

From: Date: Mon, 12 Mar 2001 15:16:36 +0000
Subject: RE: [PHP-DB] must I "while" loop
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7331@lists.php.net to get a copy of this message
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 bpaulson@chieftain.com http://www.chieftain.com 1-800-269-6397 -----Original Message----- From: olinux [mailto:olnx@yahoo.com] Sent: Monday, March 12, 2001 10:58 AM To: php-db@lists.php.net 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? olinux

« previous php.db (#7331) next »