faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 26 people (54%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

I wrote a script, but when searched brings only one set of results. How do I make it so if there is more than one result, it will display them all.

Mar 15th, 2008 21:25
dman, ha mo, Abe J-son, Martin Tuncaydin, http://www.ttnr.org


If the search-result is in an array, you can do something like this...
echo "<UL>";
$my_counter=0;
while ($result[$my_counter]!="") {
  echo "<LI>$result[$my_counter]";
  $my_counter++;
}
echo "</UL>";
If you are fetching search results from a database, try iterating over
the result set until all the rows are exhausted.