•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 392,068 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,246 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 469 | Replies: 16
![]() |
I have very limited use of using MySql - but I am trying to fix this code and it seems to be corrent. But I am still getting the error.
The website is a web directory, and the code itself checks to see the websites that arent linking back to the site.
This is Line 34
This is Lines 32 - 35
I have searched the net and tried various other methods that were posted on this forum and others and still I get the same error.
Any help and expertise would be much appreciated.
The website is a web directory, and the code itself checks to see the websites that arent linking back to the site.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/imedia/public_html/uk-webdirectory.info/admin/linkchecker.php on line 34
This is Line 34
language Syntax (Toggle Plain Text)
$total=mysql_num_rows($return);
This is Lines 32 - 35
language Syntax (Toggle Plain Text)
$query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y'ORDER BY site_id LIMIT $start,$limit"; $return=mysql_query($query,$link); $total=mysql_num_rows($return); $sess_id="PHPSESSID=".session_id();
I have searched the net and tried various other methods that were posted on this forum and others and still I get the same error.
Any help and expertise would be much appreciated.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
The error is because there is something wrong in your query. Print the query, execute it in mysql console or phpmyadmin. (Also post it here)
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 522
Reputation:
Rep Power: 2
Solved Threads: 53
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
•
•
•
•
change this :
$return=mysql_query($query,$link);
to:
$return=mysql_query($query);
That definitely wouldn't matter. Thats because mysql_query can take an optional parameter of link identifier (the variable used to 'open' the connection).
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 522
Reputation:
Rep Power: 2
Solved Threads: 53
•
•
•
•
The error is because there is something wrong in your query. Print the query, execute it in mysql console or phpmyadmin. (Also post it here)
I am not sure what you mean by printing the query, but I did test the first line and then the group of lines and the results were.
Tested:
$total=mysql_num_rows($return);
MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$TOTAL=mysql_num_rows($return)' at line 1
Tested:
$query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y'ORDER BY site_id LIMIT $start,$limit";
$return=mysql_query($query,$link);
$total=mysql_num_rows($return);
$sess_id="PHPSESSID=".session_id();
MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y'ORDE' at line 1
Where can I find the manual and version of MySQL I have and any ideas on how to fix it. I really appreciate anything you can tell me, as I am a newbie at this. Usually I just install scripts, not edit them.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
php Syntax (Toggle Plain Text)
$query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y' ORDER BY site_id LIMIT $start,$limit"; echo $query;
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
Can you post your updated code ?
echo $query; should print out the query. But anyway, post your complete code. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- PHP problem! (PHP)
- pagination not displaying results (PHP)
- Using a Serch option on a mag site. (PHP)
- Mysql num rows(): Invalid argument (PHP)
- DB-Authentication php/mysql on Mac OSX v3 (PHP)
Other Threads in the MySQL Forum
- Previous Thread: use more than two tables
- Next Thread: Mysql IsNull check



Linear Mode