我从这个查询中得到了列名:
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>';
}}
暂无答案!
目前还没有任何答案,快来回答吧!