Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 3 123 LastLast
Results 1 to 10 of 30
  1. #1
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default [PHP/mySQL] mysql_num_rows() doesn't work?

    $msgquery = mysql_query("SELECT * FROM pms WHERE to = '{$_SESSION['username']}' ORDER BY id desc",$conn);
    $msgnum = mysql_num_rows($msgquery);

    I keep getting:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource blah blah blah
    Vouches
    [x][x]

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    SELECT * FROM `pms` WHERE `to` = '' ORDER BY `id` DESC
    PHP Code:
    include 'mysql_config.php'// mysql db config file etc.

    $MySQLQuery mysql_query'SELECT * FROM `pms` WHERE `to` = "' $_SESSION'username' ] . '" ORDER BY `id` DESC' );
    $MySQLRows mysql_num_rows$MySQLQuery );

    echo 
    $MySQLRows
    Last edited by Protege; 15-03-2009 at 09:21 PM.
    Hi, names James. I am a web developer.

  3. #3
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    So the problem was that I didn't use ` right?
    Vouches
    [x][x]

  4. #4
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    I believe so.
    Hi, names James. I am a web developer.

  5. #5
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Aha thanks, it worked. +rep
    Vouches
    [x][x]

  6. #6
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    I'm also having a problem with this...

    Fatal error: Cannot redeclare clean() (previously declared in ---/config.php:60) in -------/config.php on line 66

    I have register.php which uses clean() several times. It requires config.php which has this from line 60-66:

    function clean($str) {
    if(!get_magic_quotes_gpc()) {
    $str = addslashes($str);
    }
    $str = strip_tags(htmlspecialchars($str));
    return $str;
    }

    *** is wrong with it?
    Vouches
    [x][x]

  7. #7
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    you're declaring the function clean() more then once.

  8. #8
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    I believe that means you have the function "Clean" declared twice
    Hi, names James. I am a web developer.

  9. #9
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Pretty obvious lol.

    I figured it out. I had a function in register.php that also required config.php. I just globalized the vars I needed from config.php instead.
    Vouches
    [x][x]

  10. #10
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Okay nevermind, it still doesn't work...

    Now it happens with every function I have stored in config.php. For example:

    Fatal error: Cannot redeclare clean() (previously declared in ---/config.php:60) in ---/config.php on line 66


    Lines 60-66:

    PHP Code:
    function clean($str) {
     if(!
    get_magic_quotes_gpc()) {
         
    $str addslashes($str);
        }
     
    $str strip_tags(htmlspecialchars($str));
     return 
    $str;

    I don't see what the problem is.
    Vouches
    [x][x]

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •