if ($_SERVER["REQUEST_METHOD"]=="POST") {
$updatedate=$_POST['date'];
$updateday=$_POST['day'];
$updateplace=$_POST['place'];
$updatehighlight=$_POST['highlight'];
$updatediscription=$_POST['discription'];
$sqlupdate="UPDATE $tableselect SET entrydate='$updatedate',day='$updateday',place='$updateplace',highlight='$updatehighlight',discription='$updatediscription' WHERE id ='$getid'";
$sqlquery=mysqli_query($db,$sqlupdate);
if (!mysqli_query($db,$sqlquery)) {
echo "error " .$sqlquery. "<br>" . mysqli_error($db);
}
}
Run Code Online (Sandbox Code Playgroud)
它显示此错误:
您的SQL语法有错误; 检查与MariaDB服务器版本对应的手册,以便在第1行的"1"附近使用正确的语法
这是我的代码... docrow('&ddname')没有传递.如果我使用docrow('Jhon')那么我的代码就没事了.返回时给出3行数.但是docrow有什么问题(' &DDNAME')?它给了我0行的回报.虽然有3行!
<?php
$ddname="Jhon";
include 'config.php';
//my database connection
function docrow($name){
global $conn;
$sqlquery=mysqli_query($conn,"SELECT id,name,docname,discount,docget from income where docname='$name'");
$countrow=mysqli_num_rows($sqlquery);
return $countrow;
}
echo docrow('$ddname');
?>
Run Code Online (Sandbox Code Playgroud)