Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 读取$\u POST变量_Php_Mysql_Lua - Fatal编程技术网

Php 读取$\u POST变量

Php 读取$\u POST变量,php,mysql,lua,Php,Mysql,Lua,基本上,我有一些行看起来像下图: 每个ExampleUser都有一个ID,该ID根本不会改变 我需要sql来读取$sentid的设置值。为了更好地解释,我有这个lua代码。(lua代码运行良好) 这将作为Variabel1=Data1 然后我有了这个sql代码 <?php $vote = $_POST["votes"]; $sentid = $_POST["sentid"] $conn = new mysqli("localhost","anexapleomf1"

基本上,我有一些行看起来像下图:

每个ExampleUser都有一个ID,该ID根本不会改变

我需要sql来读取
$sentid
的设置值。为了更好地解释,我有这个lua代码。(lua代码运行良好)

这将作为
Variabel1=Data1

然后我有了这个sql代码

<?php
    $vote = $_POST["votes"];
    $sentid = $_POST["sentid"]
    $conn = new mysqli("localhost","anexapleomf1","","my_anexapleomf1");
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }


    $sql = "UPDATE `my_anexapleomf1`.`President Candidates` SET votes = votes + 1 WHERE `President Candidates`.`id` = $sentid";

    if ($conn->query($sql) === TRUE) {
        echo "<br>Record updated successfully <br>";
    } else {
        echo "<br>Error updating record: <br>" . $conn->error;
    }
    $conn->close();
?>
将被解读为

WHERE `President Candidates`.`id` = 2 

您在读取代码中的post变量时没有任何问题,请尝试回显post变量以查看它是否已有效发布,如果没有,请查看表单的操作方法。

您面临的是什么buuut它没有这样做‘有点不清楚’如果你
var\u dump($\u POST),你会在页面上看到什么
WHERE `President Candidates`.`id` = $sentid  
WHERE `President Candidates`.`id` = 2