Help: With simple recalling database data usinng php...

Discussion in 'PHP' started by Skillman13, Oct 24, 2009.

  1. #1
    <?php
    $user = 'myusername';
    $pass = 'mypassword';
    $host = 'localhost';
    $db = 'mountgam_Gametab';

    @mysql_connect($host,$user,$pass) or die ('Fail');
    @mysql_select_db($db) or die ('Fail2');

    $query = ("SELECT id FROM Gamepage") or die ('Fail3');

    echo $query or die('Fail4');


    ?>

    I can't get that to work. -Or any other solution on youtube, can someone please help me?
    EDIT: it just comes up with a '1' =/
    -It should come up with the id from the Gamepage which is Test1 and Test2 (2 records)

    -Username is right, password is right, database is right, table is right, and 'id' is a field in the table.

    Thanks...
     
    Last edited: Oct 24, 2009
    Skillman13, Oct 24, 2009 IP
  2. urstop

    urstop Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to make some changes to the code , after this line of code

    Add the code like this instead of what you have above in your post
     
    Last edited: Oct 24, 2009
    urstop, Oct 24, 2009 IP
  3. Skillman13

    Skillman13 Peon

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Then it comes up with 'Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mountgam/public_html/folder/test.php on line 13'

    =| What am i doing wrong. (What does that mean?? )
     
    Skillman13, Oct 24, 2009 IP
  4. Martin K

    Martin K Active Member

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    You do not have 'mysql_query'; Try this
     
    Martin K, Oct 24, 2009 IP
  5. Skillman13

    Skillman13 Peon

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Nice =] Thanks alot... :)
     
    Skillman13, Oct 24, 2009 IP