473,799 Members | 3,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Big problems with mysql_num_rows - PLEASE HELP!

MySQL Server is version 4.1.7 (I know I should upgrade, and I will if
that is the problem but it has been working fine for 1.5 years now and
only recently has started to have this problem). Server is Linux
Redhat Enterprise 4. PHP is 4.4.4.

SQL STATEMENT:
==============
SELECT * FROM campaign_contac t cc
LEFT JOIN optins_master co
ON cc.cc_cont_id=c o.optin_id
WHERE cc.cc_camp_id=3 270
AND (co.status_flag IS NULL OR co.status_flag! ='unsub');

When I run the query, I get one of two results.

1. mysql_num_rows( ) returns the number of rows it found and all of the
data associated with it.

2. mysql_num_rows( ) returns 0 rows, but still gives me all of the
data. In the example above (cc.cc_camp_id= 3270) it gives me 2,579
rows.

There doesn't appear to be any rhyme or reason as to whether or not it
returns the appropriate row count or not. The largest database in the
query is the campaign_contac t database, but it only has approximately
15 million records in it. I am using UNSIGNED INT's for the record
id's, so I should have plenty of room to spare. On disk that database
takes up 439MB for the data and just over 1GB for the indexes.

I've shutdown the server and ran checks on everything to fix any index
problems (twice) and I still get the same problem.

Checking the packages I noticed this:

mysql-devel-4.1.7-4.RHEL4.1
mysql-server-4.1.7-4.RHEL4.1
mysql-4.1.7-4.RHEL4.1
mysqlclient10-3.23.58-4.RHEL4.1

^^^ mysqlclient v3.23.58?? I'm not sure if that could be causing the
problem, if it is I don't know why it has worked for 1.5 years now and
then all of the sudden we have issues.

I'm one of those people who don't believe in fixing something that
isn't broken. I'm happy to upgrade to 5.x if I know for sure it will
fix the problem, but I can't afford the time or money to upgrade if
I'll still be in the same boat.

*** UPDATE ***
I have upgraded everything to MySQL v5.0.27 (client/server/
development), and I recompiled PHP v4.4.4 and now it consistantly
returns 0 results (even though I still get all of my results if I were
to enumerate the $results returned from the mysql_query. Even
phpMyAdmin shows 0 results returns, but then below that it displays
all of the matching rows.

I am unbelievably confused, if anyone could shed light on this I'd
greatly appreciate it.

Thanks for your help,
-- Rob

Feb 26 '07 #1
1 1655
go****@framevil lage.com wrote:
>
SQL STATEMENT:
==============
SELECT * FROM campaign_contac t cc
LEFT JOIN optins_master co
ON cc.cc_cont_id=c o.optin_id
WHERE cc.cc_camp_id=3 270
AND (co.status_flag IS NULL OR co.status_flag! ='unsub');

When I run the query, I get one of two results.

1. mysql_num_rows( ) returns the number of rows it found and all of the
data associated with it.

2. mysql_num_rows( ) returns 0 rows, but still gives me all of the
data. In the example above (cc.cc_camp_id= 3270) it gives me 2,579
rows.
Taking a wild stab in the dark, the num_rows is only known if the query
result is cached / and/or you iterate to the end of the data set on this or
the previous access.

Try asking on a MySQL list for more educated guesses.

C.
Feb 26 '07 #2

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

Similar topics

2
3594
by: Nathan Given | last post by:
I run a book exchange web site based in PHP with a mysql database. Many users have having trouble logging in. Here is a description of the problem. A user types in his/her username and password and hits login. The browser thinks for a bit then the login screen comes up again and nothing has happened (except now the username and password fields are blank).
4
2110
by: David Nikel | last post by:
I am attempting to create a login script. The following snippet of code: $query = "select * from auth where username='$username' and password=password('$password')"; $result = mysql_query($query, $db_conn); $num = mysql_num_rows($result); echo $num;
2
3228
by: Me | last post by:
I made a login script which retrieves username and password from a database, I can get it to work if the passwords in the database are not encrypted and if I dont encrypt the password when it is entered, but if I encrypt the password that has been entered and try to match with the encrypted one in the database then it does not work, can anyone help me please, I have included both the sources here. Source with password not encrypted: ...
3
4487
by: Bert Sierra | last post by:
Hello -- I have what appears to be a simple PHP+MySQL query, but Dreamweaver consistently generates PHP code which won't parse. I've stared at the PHP code for several hours now, and I can't see the problem. Thanks in advance for any input you might have to the problem.
2
1411
by: robertcode | last post by:
Hey all, I'm pretty new to php so please keep that in mind when you razz me. ;) Anyway, I'm trying to make it so that 3 columns of links will show up on a page so link1 link2 link3 link4 link5 link6 link7 link8 link9
3
3920
by: petemaxi | last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\tockholes\includes\menu.inc.php on line 9 <div class="left"> <div class="menu"> <div class="boxhead" style="text-align:center;"> <strong>Menu</strong> </div> <br /> <?php require ('includes/db_conn.inc.php'); $query = "select * from menu order by item_order"; $result = mysql_query($query);
2
1903
by: starfi3ld | last post by:
I got a few errors with this script Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line 15 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line 70 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result...
4
7838
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20 You have not entered all the fields Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 34 Sorry You failed to enter the correct old password I was wondering if anyone could help me, I have...
4
3632
by: seigaku | last post by:
Hi everyone, I've recently begun learning PHP and it looks like I took on too much so soon. I'm attempting to fix a php script that detects whether or not a person is Eligible to join a tournament or not when they register and attempt to join. I'm doing it locally at the moment so i don't need to upload every 5 minutes. Any assistance would be appreciated. On register.php, I am receiving the following error: Warning:...
0
9546
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.