AOA Forums AOA Forums AOA Forums Folding For Team 45 AOA Files Home Front Page Become an AOA Subscriber! UserCP Calendar Memberlist FAQ Search Forum Home


Go Back   AOA Forums > Software > Programming and Assembly Language

Programming and Assembly Language Please read this Topic's rules!!


Reply
 
LinkBack Thread Tools Rate Thread
  #1 (permalink)  
Old 23rd May, 2010, 05:27 AM
Member
 
Join Date: May 2010
Posts: 8

MySql_num_row error

Halp



Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/apidinf1/public_html/login.php on line 25
No.

Line 25:
$count=mysql_num_rows($sql);

__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 23rd May, 2010, 06:14 AM
Gizmo's Avatar
Chief BBS Administrator
BassTeroids Champion, Global Player Champion, Aim & Fire Champion, Puzzle Maniax Champion, Othello Champion, Canyon Glider Champion, Unicycle Challenge Champion, YetiSports 9: Final Spit Champion, Zed Champion
 
Join Date: May 2003
Location: Webb City, Mo
Posts: 16,178
Send a message via ICQ to Gizmo Send a message via AIM to Gizmo Send a message via MSN to Gizmo Send a message via Yahoo to Gizmo Send a message via Skype™ to Gizmo

Exactly what it says:

$sql is not a MySQL result resource.

When calling MySQL from within PHP, you have to do something similar to the following:

Code:
if($DBConnect = mysql_connect($DBHost, $DBName, $DBPass))
{
  echo "Connected to MySQL";
  if(mysql_select_db("aoafiles", $DBConnect))
  {
    echo "DB Selected";
    $MyQuery = "add some kind of sql query here";
    $QueryResult = mysql_query($MyQuery);
    if($QueryResult !== false)
    {
      $count = mysql_num_rows($QueryResult);
    }
  }
  else
    echo "Unable to select DB";
}
else
  echo "Connection failed";
Obviously, you have to define $DBHost, $DBName, and $DBPass as appropriate.

The error you are getting is typically the result of bad error checking on the part of the programmer; a query was executed that failed, but the programmer never checked the return code (in this case, the query result $sql, which will either be false or a mysql result resource).

Last edited by Gizmo; 23rd May, 2010 at 06:24 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SMP error? Necorum Windows/Linux SMP Clients 12 20th February, 2009 03:52 AM
WoW: Error 132 skool h8r GAMES! OH YEAH! 34 6th May, 2007 10:22 AM
A Error Microgers87 CRASHED! 4 4th December, 2003 09:39 PM
AOA error eobard Forum Feedback and Suggestion Box 3 29th May, 2002 08:17 PM
error help me! majestic CRASHED! 4 27th May, 2002 07:43 PM


All times are GMT +1. The time now is 07:12 AM.


Copyright ©2001 - 2010, AOA Forums
Don't Click Here Don't Click Here Either

Search Engine Friendly URLs by vBSEO 3.3.0