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!


Results 1 to 7 of 7

Thread: Resource id #17

  1. #1
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default Resource id #17

    When i do

    PHP Code:
    $sql "SELECT COUNT(username) FROM user_sys";
    $registered mysql_query("$sql");
    echo 
    $registered
    Its ment to cound the number of records in the username row in the user_sys table, but it just displays "Resource id #17". Ive never used SQL before so i dont know how to fix it

    +rep for help
    Lets set the stage on fire, and hollywood will be jealous.

  2. #2
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Tom743 View Post
    When i do

    PHP Code:
    $sql "SELECT COUNT(username) FROM user_sys";
    $registered mysql_query("$sql");
    echo 
    $registered
    Its ment to cound the number of records in the username row in the user_sys table, but it just displays "Resource id #17". Ive never used SQL before so i dont know how to fix it

    +rep for help
    $sql = mysql_query( "SELECT COUNT(`username`) FROM `user_sys`" );
    $fetch = mysql_fetch_array( $sql );
    echo( $fetch[0] );

    should do it not used count() much so I don't know what it returns as

  3. #3
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jewish Bear View Post
    $sql = mysql_query( "SELECT COUNT(`username`) FROM `user_sys`" );
    $fetch = mysql_fetch_array( $sql );
    echo( $fetch[0] );

    should do it not used count() much so I don't know what it returns as
    It works Thanks +rep.
    Lets set the stage on fire, and hollywood will be jealous.

  4. #4
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    That seems pretty complex, there's a pre-made function for that already

    mysql_list_fields.. This is what I did (After the database was connected)

    PHP Code:
    $user mysql_list_fields("nivade_core""peepz"); // Database then Table. 
    and the same for comments

  5. #5
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Minor View Post
    That seems pretty complex, there's a pre-made function for that already

    mysql_list_fields.. This is what I did (After the database was connected)

    PHP Code:
    $user mysql_list_fields("nivade_core""peepz"); // Database then Table. 
    and the same for comments
    That would list fields, not count.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  6. #6
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jewish Bear View Post
    That would list fields, not count.
    Oh, I thought that he was counting fields.

  7. #7
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Minor View Post
    Oh, I thought that he was counting fields.
    He is, listing fields gives the field names, not the count of them.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

Posting Permissions

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