views:

425

answers:

1

Hello everyone, i am trying to get the current logged in user's friends, they should select one friend using the form below and then submit it to the same page. The script is suppose to get the friend's userid (only one) and add it to the database.

The script is working fine but its not posting the right ID (Wrong ID $_POST['friend_selector_id']), it posts an id that looks like this: 2147483647 and i am not sure if this is the profile id or what but i need the id that you use with this code <fb:profile-pic uid=. i need the userid. Could somebody help me out ?

Thank You :D

<form action="<?php echo $appCanvasUrl.'challenge.php?gameid='.$_GET[gameid].'&userid='.$user.'&userid2='.$friend_selector_id; ?>" id="challenge" method="post">
<fb:friend-selector uid="<?PHP echo $user; ?>" name="userid2" idname="friend_selector_id"/>
<INPUT type="submit" value="Challenge"> </form>
<?php
    if(isset($_GET['gameid']) && is_numeric($_GET['userid']) && isset($_GET['userid2'])) {
    $gameid = am_injection($_GET[gameid]);
    $userid2 = am_injection($_POST['friend_selector_id']);
    $userid1 = am_injection($user);
    am_queries($db, "INSERT INTO `AMCMS_challenges` (`primkey` ,`userkey1` ,`userkey2` ,`gameid` ,`winner`, `score1`, `score2`) VALUES (NULL, $userid1, $userid2, $gameid, 0, 0, 0);");
    echo 'Challenge recorded.';
    } else {
    echo 'Please select a friend to challenge!';
    exit;
    }
A: 

My bad, it wasnt the script, it was my database. i had to set the fields to BIGINT otherwise the number recorded in the database was completely different :)

Sorry for the trouble :(

Krasi

related questions