Hi,

So i use $.post to call click.php.  The variables are getting posted
to this function correctly confirmed via firebug

id      197
player1 false
pos     b4
turn    bid

in my php code, i get them immediately, but when i use $id in mySQL,
it seems to disappear:

<?php
        include 'dbconnect.php';
        $id = $_POST['id'];
        $pos = $_POST['pos'];
        $p1 = $_POST['p1'] == 'true';
        if($_POST['turn'] == 'bid'){
                $turn = 0;
        }else if($p1){
                $turn = 5;
        }else{ $turn = 6;}
        //Malfunctioning Line Below
        $str = "SELECT board_id, p1bid, p2bid, play FROM bttt WHERE id =
$id";
        $query = mysql_query($str) or die($str);
        $data = mysql_fetch_assoc($query);
        if($p1){
                $str2 = "UPDATE bttt_board SET $pos = 'x' WHERE id=" .
$data['board_id'];
        }else{
                $str2 = "UPDATE bttt_board SET $pos = 'o' WHERE id=" .
$data['board_id'];
        }mysql_query($str2) or die($str2);
        $play = $data['play'] . $data['p1bid'] . ',' . $data['p2bid'] . ',' .
$pos . ',';
        $str3 = "UPDATE bttt SET turn_state=$turn, play=" . "'" . $play .
"'" . "WHERE id=$id";
        mysql_query($str3) or die($str3);
?>

die is returning

SELECT board_id, p1bid, p2bid, play FROM bttt WHERE id =

Why is this?? Also, quick question while i have your attention:

is $_POST['p1'] the string or boolean 'false'?

Reply via email to