By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Return A Value To The Top Of The Script

P: 161
Ok, I have a page that writes the results that are shown and I would like to count them then return the number wich would be stored in a variable to the top of the page. So it can show how many results it retrived. Then showing at the bottom which would not help the user that much if their was a thousand results.

Example of a code that does not work.

[PHP]$NumOfResults = 0;

echo "There Are ".$NumOfResults." result(s)."; //Display number of rows.

$result = $row[result];


echo $result;
This is just a example just to give you a idea what I am trying to do.

I know I can use the mysql function to retrive the results, but It does not help for the results that are really displaying.
Dec 17 '07 #1
Share this Question
Share on Google+
2 Replies

P: 48
instead of
[PHP] echo $result;[/PHP]
do [PHP]$string .= $result ;[/PHP]
and then
[PHP] echo "There Are ".$NumOfResults." result(s).";
echo $string ;[/PHP]

You can also control the output buffer (obstart / obgetclean / ...)
Dec 18 '07 #2

P: 161
Thank you very much for your reply. This will indeed help me with my project a lot. :)
Dec 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.