473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

found_rows() everytime returns 1

hi to all
I use this query
SELECT SQL_CALC_FOUND_ROWS * FROM prods LIMIT 100,10;

I'd like to know how many rows this query returns without limit, but
using this
select FOUND_ROWS();
the result is everytime 1

You know why?
No other query are processed before the found_rows().
Thanks

--
Andrea

May 3 '06 #1
6 11317
Not an answer to your question, but I figured that I'd try and run it
on my server... here is my results.

I'm using: mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (x86_64)

I ran all of these queries in this exact sequence:

If I run 'select * from client;' I get 264 rows
If I run 'select found_rows();' I get the correct value of 264
If I run 'select * from client limit 100,10;' I will get 10 rows
If I run 'select found_rows();' I erroneously get 110

So I guess its pretty much broken... I'll stay away from it!

Jeach!

May 4 '06 #2
You haven't use the SQL_CALC_FOUND_ROWS.
In the manual you can find "If the preceding SELECT statement does not
include the SQL_CALC_FOUND_ROWS option, then FOUND_ROWS() may return a
different result when LIMIT is used than when it is not."
If you can, try with this option.

p.s. i use on my server mysql 5.0.18
--
Andrea

May 4 '06 #3
mmmhhhh
I ran the queries using the MySQL Query Browser software
(http://www.mysql.com/products/tools/query-browser/)
and the result of found_rows was 1.
I ran the two queries above in a php page and the count of rows was
correct. I have lost many time for this problem :(

--
Andrea

May 4 '06 #4
mmmhhhh
I ran the queries using the MySQL Query Browser software
(http://www.mysql.com/products/tools/query-browser/)
and the result of found_rows was 1.
I ran the two queries above in a php page and the count of rows was
correct. I have lost many time for this problem :(

--
Andrea

May 4 '06 #5
mmmhhhh
I ran the queries using the MySQL Query Browser software
(http://www.mysql.com/products/tools/query-browser/)
and the result of found_rows was 1.
I ran the two queries above in a php page and the count of rows was
correct. I have lost many time for this problem :(

--
Andrea

May 4 '06 #6
andrea azzini wrote:
I ran the queries using the MySQL Query Browser software
(http://www.mysql.com/products/tools/query-browser/)
and the result of found_rows was 1.


MySQL Query Browser opens a new connection for each statement you
execute. The value returned by FOUND_ROWS() is relevant only during the
current connection. So there is no way to use this function in MySQL
Query Browser; you must use the command-line tool 'mysql'.

FWIW, the same issue happens when trying to use other session-dependent
features in MySQL Query Browser, such as LAST_INSERT_ID() and user
variables.

Regards,
Bill K.
May 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard Hollenbeck | last post by:
Is there JavaScript code I could insert into a page to automatically notfy me by email everytime I get a hit on a certain webpage?
3
by: aaagent | last post by:
I have a test WinApp that I use to test middle-tier methods why am I having to re-GAC everytime I re-compile in order to debug into my middle-tier projects?
8
by: Abhishek | last post by:
Hi! I need to create a unique password everytime i click a button . what technique/Algo should i follow. Abhishek
2
by: Harry Whitehouse | last post by:
I'm coming from an ISAPI background and migrating code to Webservices. In the ISAPI world, there are sections of code that are invoked only once when the DLL is loaded by IIS. It's a place...
1
by: howachen | last post by:
Hi, Suppose many users will issue SELECT statement to the server, e.g. 1. UserA issued a SELECT statement 2. UserA issued FOUND_ROWS() and get the correct result The above is okay, but...
1
by: hhyong99 | last post by:
I need to populate a textarea with different id in a form everytime a button is clicked. Is there any way to do this? thanks
2
by: David Lozzi | last post by:
Howdy, It appears my dynamic build feature in VS 2005 has stopped working. I have to build my asp.net project everytime I make a change to code behind OR the html front end. Any ideas? ...
9
by: Achintya | last post by:
Is it good to assert the pointer *each* time after a new() is called? or it should be a normal if condition check. which of below is good practice: (I know assert works only in debug) 1) .........
6
by: crack.the.hack | last post by:
Hi All, If I am changing the database machine, what should I do not to prep bind the sqc files everytime. Because I need to build my application everytime the database is changed? Is there...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.