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 2 12 LastLast
Results 1 to 10 of 11

Thread: PHP Error

  1. #1
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default PHP Error

    In My Dj Panel My Dj Says is *****ing up

    Heres the error:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/habbonew/public_html/dj_staff/says.php on line 3

    Heres my page code

    PHP Code:
    <?php
    $query 
    mysql_query("SELECT * FROM users WHERE username = '$logged[username]'");
    $row mysql_fetch_array($query);
    echo 
    "<b>".$row["username"]."</b></br>";
    echo 
    "<i>Says, ".$row["comment"]."</i><br><br>";
    ?>
    Whats wrong
    Last edited by Dentafrice1; 26-03-2006 at 01:30 PM.

  2. #2
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    There's a problem with $query



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  3. #3
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
      $query 
    mysql_query("SELECT * FROM 'shoutout'");
      
    $row mysql_fetch_array($query);
     echo 
    "<b>".$row["username"]."</b></br>";
     echo 
    "<i>Says, ".$row["comment"]."</i><br><br>";
    ?>
    There it is now What is the problem with query?
    Last edited by Dentafrice1; 26-03-2006 at 01:35 PM.

  4. #4
    Join Date
    Aug 2005
    Location
    Newcastle
    Posts
    1,417
    Tokens
    0

    Latest Awards:

    Default

    <?php
    $query = mysql_query("SELECT * FROM users WHERE username = '$logged[username]'");
    $row = mysql_fetch_array("$query");
    echo "<b>".$row["username"]."</b></br>";
    echo "<i>Says, ".$row["comment"]."</i><br><br>";
    ?>
    Also your second post is the same as the first?
    Try that what I have ^

    - Craig.



  5. #5
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    <?php
    $query = mysql_query("SELECT * FROM 'shoutout'");
    $row = mysql_fetch_array($query);
    echo "<b>".$row["username"]."</b></br>";
    echo "<i>Says, ".$row["comment"]."</i><br><br>";
    ?>

    I edited it i pasted the wrong thing

    But can you help?? Theres something wrong

  6. #6
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    <?php
    $query = mysql_query("SELECT * FROM `shoutout`");
    $row = mysql_fetch_array($query);
    echo "<b>".$row["username"]."</b></br>";
    echo "<i>Says, ".$row["comment"]."</i><br><br>";
    ?>

    There ya go

  7. #7
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    $query mysql_query('SELECT * FROM users WHERE username = \''.$logged[username].'\''); 
    kinda quit.

  8. #8
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    TY Plus rep to both of you

  9. #9
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    Wheres the connection? Also just change the $logged['username'] to ".$logged['username']." and it should be ok. Also instead of just using $row = mysql_fetch_array($query);
    its best to use:
    PHP Code:
     while($row mysql_fetch_array($query)) {
    echo 
    "RESULTS HERE ;)";

    Last edited by Splinter; 26-03-2006 at 02:56 PM.

  10. #10
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    Quote Originally Posted by Splinter
    Wheres the connection? Also just change the $logged['username'] to ".$logged['username']." and it should be ok. Also instead of just using $row = mysql_fetch_array($query);
    its best to use:
    PHP Code:
     while($row mysql_fetch_array($query)) {
    echo 
    "RESULTS HERE ;)";

    What would display everything in the table, as this is for a 'DJ Says' he would only need to display the last row.

Page 1 of 2 12 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
  •