Re: A while loop prob ?

From: Date: Wed, 13 Feb 2002 20:58:08 +0000
Subject: Re: A while loop prob ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16928@lists.php.net to get a copy of this message
Heh, with the help from Mr. Emery, I see the/a part of the problem now. You have to fetch the results before you can extract the data into variables. After you do the query, you must run a/the mysql_fetch_array. HTH -w -- William Fong - wfong@mookandblanchard.com Phone: 626.968.6424 x210 | Fax: 626.968.6877 Wireless #: 805.490.7732 | Wireless E-mail: 8054907732@mobile.att.net ----- Original Message ----- From: "Dave Carrera" <dave@davecarrera.com> To: "php List" <php-db@lists.php.net> Sent: Wednesday, February 13, 2002 11:40 AM Subject: [PHP-DB] A while loop prob ? : Hi All : : What have I done wrong here. : : 3 yes 3 hours I have been plaing with this loop. : : All it shows is the last record in my db. : : It should show and record containing any string in the search. : : Error works : : Please help I beg you....... : : As always thank you for any help : : Dave C : : --------- My Code Starts Here ------------ : : if ($submit){ : if($search == ""){ : $error1 = "<font color=red>No Records found. Please use at least : 1 character in search box</font>"; : } : else : { : $srchsql = "select * from $tbn where name like \"%$search%\" "; : $srchresult = mysql_query($srchsql, $con); : $name =$srchrow['name']; : $details =$srchrow['details']; : $price =$srchrow['price']; : $imgloc =$srchrow['imgloc']; : while (list($name, $details, $price, $imgloc) : =mysql_fetch_array($srchresult)){ : : $display_srch_rows = : "<tr><td>$imgloc</td><td>$name</td><td>$details</td><td>$price</td></tr> : "; : } : } : } : : Dave Carrera : Website Designer : http://www.davecarrera.com : : : : : -- : PHP Database Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : :

« previous php.db (#16928) next »