在 mysql 表中,我有 3 个字段。user_to、user_from 和 id。变量都是正确的,应该插入正确的数据。
当单击一个名为“poke”的按钮时,它应该插入一个 cookie,该 cookie 存储了执行此操作的人和被戳的人的会话。它似乎没有插入,我被卡住了:(
$cookie = $_SESSION['user_login'];
//Poke code
if (@$_POST['poke']) {
$check_if_poked = mysql_query("SELECT * FROM pokes WHERE user_to='$username' && user_from='$added_by'");
$num_poke_found = mysql_num_rows($check_if_poked);
if ($num_poke_found == 1) {
echo "Come on! Give the guy a chance!";
}
else
if ($username == $cookie) {
echo "You cannot Jab yourself.";
}
else
{ $poke_user = mysql_query("INSERT INTO `pokes` ('user_from', 'user_to') VALUES ('$cookie', '$username')") or trigger_error(mysql_error());
echo "$username has been jabbed.";
}
}