must I "while" loop

From: Date: Mon, 12 Mar 2001 17:58:09 +0000
Subject: must I "while" loop
Groups: php.db 
Request: Send a blank email to php-db+get-7328@lists.php.net to get a copy of this message
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 (#7328) next »