LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-28-2006, 07:18 AM   #1
yunus.raza
LQ Newbie
 
Registered: Jul 2004
Location: India
Posts: 16

Rep: Reputation: 0
Mysql and PHP problem


Hi,

I have been running my PHP-Nuke site on my Red Hat 7.3 for quite some years now.

All of a sudden i am seeing the following error at the top of my page. Site however is working fine. But i want to remove this error as it doesnt looks good on the site, which is a part of Intranet of the company.

The error at the top of the page looks like this:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/nuke/html/includes/sql_layer.php on line 253

What shall i do to fix this issue??

Thanks
Yunus
 
Old 08-28-2006, 07:56 AM   #2
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Rep: Reputation: 30
i usually get this when i have a syntax error in my php code, like a mis-spelled table name, and what-not.
mysql_num_rows will have an argument in it that matches a query you ran.

like this
Code:
$query = mysql_query("SELECT `name` FROM `customers` WHERE `age` > 35 ");
$how_many = mysql_num_rows($query); // tells how many customers are over 35 years old
Just check those lines in the script in the error output message and make sure that everything is set up right.
 
Old 08-29-2006, 12:44 AM   #3
leandean
Member
 
Registered: Oct 2005
Location: Burley, WA
Distribution: Sabayon, Debian
Posts: 278

Rep: Reputation: Disabled
A corrupted table will also cause this error. Run mysqlcheck and if it shows an error run mysql> fix table <name>.
 
Old 08-29-2006, 03:02 AM   #4
yunus.raza
LQ Newbie
 
Registered: Jul 2004
Location: India
Posts: 16

Original Poster
Rep: Reputation: 0
Yes it was a table issue.

I ran "mysqlcheck -A" and found that one of the table had issue like the following:

nuke.nuke_stats_hour
warning : Table is marked as crashed
warning : Size of datafile is: 249856 Should be: 249850
error : got error: -1 when reading datafile at record: 24985
error : Corrupt

Then i ran "mysqlcheck -r <dbname>" and the problem got solved.

Thanks both of you in giving me idea to solve this problem.

Cheers
Yunus
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php-mysql dependancy problem after nitemare mysql upgrade. RHEL4 andrewc Red Hat 1 01-03-2006 04:16 PM
MySQL/php problem Basslord1124 Fedora 11 03-06-2005 02:44 PM
Problem with PHP and MySQL eam Programming 2 08-24-2004 02:33 PM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 08:54 PM
MySQL / PHP problem jjd228 Linux - Software 5 03-15-2004 10:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration