Why isnt my facebook application working? php error.. help

Discussion in 'PHP' started by spect, Dec 7, 2009.

  1. #1
    spect, Dec 7, 2009 IP
  2. SIAWebDesign

    SIAWebDesign Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a8400355/public_html/index.php on line 9
    Code (markup):
    That basically means the same thing it would mean in a regular PHP script. The mysql result is not valid which means your mysql query probably failed.

    try printing the mysql query before it's executed and run it manually in your mysql database. Or try printing the error with mysql_error() when you execute the query.

    you can use something like this:

    $result = mysql_query($query) or die("an error occured: " . mysql_error());
    Code (markup):
     
    SIAWebDesign, Dec 7, 2009 IP
  3. kingsoflegend

    kingsoflegend Well-Known Member

    Messages:
    202
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Obviously it's not working because it's broken. Also your website is under review by your hosting company so without you telling us what errors you're getting, we can't help you.
     
    kingsoflegend, Dec 7, 2009 IP
  4. spect

    spect Peon

    Messages:
    324
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So if i created a new database would it work? what would i have to do to the mysql database?
     
    spect, Dec 7, 2009 IP
  5. spect

    spect Peon

    Messages:
    324
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?php
    require_once "facebook.php";
    require_once "app.php";
    $user_id = $facebook->require_login();

    require_once "db.php";
    $sql="select * from memorymeter where uid=".$user_id;
    $result=mysql_query($sql);
    $res=mysql_fetch_assoc($result);
    $record=$res['bestrecord'];


    $friends = $facebook->api_client->friends_get();

    $user_details=$facebook->api_client->users_getInfo($friends, array('pic_square'));
    ?>
    <center>
    <?
    include_once "topbanner.php";
    ?>
    </center>

    <?
     
    spect, Dec 7, 2009 IP
  6. CoreyPeerFly

    CoreyPeerFly Notable Member Affiliate Manager

    Messages:
    394
    Likes Received:
    24
    Best Answers:
    5
    Trophy Points:
    240
    #6
    Edit:
    $sql="select * from memorymeter where uid=".$user_id;
    $result=mysql_query($sql);
    PHP:
    To this:
    $sql = "SELECT * FROM `memorymeter` WHERE `uid` = '" . $user_id . "'";
    $result = mysql_query($sql) or die(mysql_error());
    PHP:
     
    CoreyPeerFly, Dec 7, 2009 IP
  7. spect

    spect Peon

    Messages:
    324
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    now getting this error.

    Table 'a8400355_fbmemor.memorymeter' doesn't exist
     
    spect, Dec 7, 2009 IP
  8. SIAWebDesign

    SIAWebDesign Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Well, now that just means you don't have a 'memorymeter' table in your database.

    Have you even created a database for this application yet?
     
    SIAWebDesign, Dec 7, 2009 IP
  9. EngineerofSuccess

    EngineerofSuccess Well-Known Member

    Messages:
    680
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #9
    EngineerofSuccess, Dec 7, 2009 IP