Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jul 2007
    Posts
    64
    Member #
    15493
    Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /edit/database.php on line 194


    Now here's the code:

    function getNumMembers(){
    if($this->num_members < 0){
    $q = "SELECT * FROM ".TBL_USERS;
    $result = mysql_query($q, $this->connection);
    $this->num_members = mysql_numrows($result);
    Really don't know what the problem is.

  2.  

  3. #2
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    Var_dump($result);
    Shani

    I have an eye for detail like you'd never believe.

  4. #3
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    I get this error a LOT. Usually it'll have to do with the query... Are you sure TBL_USERS is correct? And to be picky... I believe mysql_num_rows is the correct function. But its the same thing, don't worry.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yeah, the debugging way of doing this is:
    PHP Code:
    mysql_query($query$connection) or die(mysql_error()); 
    Which will make the page quit and display whatever error mysql gave if an error occurs. Make sure to get rid of this when you deploy, though, since you don't want your users seeing your errors (it's a potential security vulnerability).


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:19 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com