Re: returning all rows
| From: | Bogdan Stancescu | Date: | Mon, 20 May 2002 16:51:21 +0000 |
| Subject: | Re: returning all rows | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19282@lists.php.net to get a copy of this message | ||
Well, then maybe you only have one row with that city in the database? If you want to order, but return all rows, use ORDER BY.
Plus, you don't output anything in the while loop - how do you know there's only one row?
Bogdan
Todd Williamsen wrote:
It needs that line to sort them by city. But it only returns one row "Bogdan Stancescu" <mgv@fx.ro> wrote in message news:3CE921F1.5090403@fx.ro...Just lose the "WHERE city=\"$city\" in the SQL. Bogdan Todd Williamsen wrote:haveI know I have asked this silly question before, but forgive me since Ibeen a bit rusty with PHP lately So how do I return all rows? I have this: $sql= "SELECT id, city, date FROM meetings WHERE city = \"$city\" "; $result = mysql_query($sql,$connection) or die("Couldn't execute query"); while ($row = mysql_fetch_array($result)) { $id = $row["id"]; $city = $row["city"]; $date = $row["date"]; } echo "$date"; ?>