我在phpvar中的列名查询中找不到错误

qij5mzcb  于 2021-06-19  发布在  Mysql
关注(0)|答案(0)|浏览(166)

我从这个查询中得到了列名:

SHOW COLUMNS FROM $table

我需要删除从第一个查询得到的列中具有特定值的行:

$con = mysqli_connect("localhost","root","password","database");
if(isset($_POST['sup'])){

    if(mysqli_connect_error()){
        echo "Failed connection";exit;
    }
    $table=$_POST['table_sup'];
$requet = "SHOW COLUMNS FROM $table";
$result = mysqli_query($con,$requet);
if(!$result){
    echo "requete incorrecte";
}
$j=0;
while($row=mysqli_fetch_array($result)){
   $monChamps=$row["Field"];
   $row1[$j]=$monChamps."<br>";
    $j++;
}

$champ1=$_POST['champ_sup'];
$id=$row1[0];
$requet1="DELETE FROM $table  WHERE $id='$champ1'";
if(mysqli_query($con,$requet1)){
    echo '<script language="javascript">';
    echo 'alert("supprimer")';
    echo '</script>';
}}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题