Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
HOw to count total number of results found in php.
Old 03-17-2010, 06:35 AM HOw to count total number of results found in php.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi,

I want to show the total # of records search by the query string at the top of my page.....Please let me know how can I do this.

Any explaining answer would be highly appreciated.

Thanks A Lot!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-17-2010, 06:54 AM Re: HOw to count total number of results found in php.
voxink's Avatar
Novice Talker

Posts: 13
Name: Adrian
Trades: 0
If you display all the results on the page, increase a variable every time you display a record.

If you display the results like a pagination, you need to have the query return your results and also the total number, or create another query for the total number of results.
voxink is offline
Reply With Quote
View Public Profile
 
Old 03-17-2010, 06:57 AM Re: HOw to count total number of results found in php.
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
http://www.php.net/manual/en/functio...l-num-rows.php
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 03-17-2010, 06:58 AM Re: HOw to count total number of results found in php.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by voxink View Post
If you display all the results on the page, increase a variable every time you display a record.

If you display the results like a pagination, you need to have the query return your results and also the total number, or create another query for the total number of results.

May you please explain with example.....

As I was trying this.

PHP Code:
$sql_b="select biz_nam, COUNT(biz_id) from tblbusiness where `biz_name` like '$biznam%' and biz_city = '$bizcity'";
        
$result_b=mysql_query($sql_b);
        
$b=0;
        while(
$row_b=mysql_fetch_array($result_b))
        {
        
$b++;
        } 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-17-2010, 07:05 AM Re: HOw to count total number of results found in php.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by tripy View Post

Thanks Tripy..........its working........now.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-23-2010, 10:08 AM Re: HOw to count total number of results found in php.
Experienced Talker

Posts: 41
Name: Adam B
Trades: 0
Just remember if you want to paginate the results, mysql_num_rows() will be no use.
adam89 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to HOw to count total number of results found in php.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36727 seconds with 12 queries