Matt Davis pressed the little lettered thingies in this order...

> I have a php script which runs a query and then outputs the results in to
> html. The html should repeat itself depending on the number of results. i.e
> to produce search results.
> 
> I know that my current query should return 5 results however it is only
> show the last one. Is there something I need to do to show all my results.
> 

It sounds like you're ending your loop too soon.

Something like:
$result=mysql("DB","query");
        while ($row = mysql_fetch_row($result)) {
        $var = $row[0];
        }
echo $var;

This causes the while() loop to perform and on each loop (each result), 
the value of $var gets replaced with the next value.  When you do this 
and you cause the loop to exit, you will only see the last value of $var 
(the last result from the query).

Try placing the "echo $var;" portion within the curly braces.  This will 
cause the value of $var to be echoed for each result.

If I'm wrong, you'll need to send the code you are trying to use for 
anyone to be of much help.

Good luck...

Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com

For a good time,
http://www.AppIdeas.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to