473,385 Members | 1,356 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,385 software developers and data experts.

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_contact cc
LEFT JOIN optins_master co
ON cc.cc_cont_id=co.optin_id
WHERE cc.cc_camp_id=3270
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_contact 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 1633
go****@framevillage.com wrote:
>
SQL STATEMENT:
==============
SELECT * FROM campaign_contact cc
LEFT JOIN optins_master co
ON cc.cc_cont_id=co.optin_id
WHERE cc.cc_camp_id=3270
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
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...
4
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 =...
2
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...
3
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...
2
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...
3
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">...
2
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...
4
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...
4
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.