更新mysqli php +1

时间:2015-10-29 16:55:37

标签: php mysqli

帮助,插入命令工作但更新命令没有工作,我尝试了20个不同版本的语句。任何帮助都会很棒。

else if ($owner_count1[0] == 1 && $votedcount[0] < 1){
        $sql = "UPDATE 'status' SET 'voteup'=['voteup' + 1] WHERE 'status' . 'id'= $postidd";
        $query = mysqli_query($db_conx, $sql);
        $sql = "INSERT INTO votes(postid, account_name, author, updown, vdate) VALUES('$postidd','$usera','$authora','a',now())";
        $query = mysqli_query($db_conx, $sql);
        mysqli_close($db_conx);
        echo "vote_up_sent";
        exit();
    }

1 个答案:

答案 0 :(得分:0)

尝试以下查询:

$sql = "UPDATE status SET voteup = voteup + 1 WHERE status.id = '$postidd'";

$sql = "INSERT INTO votes (postid, account_name, author, updown, vdate) VALUES ('$postidd', '$usera', '$authora', 'a', NOW())";