尝试从PHP中删除sql查询时出现白屏

时间:2022-09-06 16:27:51

My screen is white, no php errors, no sql errors... just white. What is wrong in my code?

我的屏幕是白色的,没有php错误,没有sql错误......只是白色。我的代码有什么问题?

<?PHP  require ("../SQL.php");
if($id=filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING)); else
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING);
$editare = "SELECT marca, model FROM modele WHERE id={$id};";
foreach ($dbh->query($editare) as $linie)
{
$id                    = $linie['id'];
$marca                 = $linie['marca'];
$model                 = $linie['model'];
} ?>
<?php require ("../SQL.php");   


$editare = "DELETE FROM modele WHERE id=$id"; 

if ($dbh->query($editare)) 
{
 print '<center><h2><img src="http://bahoy.tk/images/ok.png"></img><br /><br   />Telefonul/Tableta este sters!</h2><br />
Vei fi redirectionat in cateva momente inspre adaugarea unui nou model de tableta sau  telefon!
<meta http-equiv="refresh" content="2; URL=index.php"/></center>'; 
}
else(mysql_error())     
?>

I just want to delete all from specified id with one query.

我只想用一个查询从指定的id中删除所有内容。

1 个解决方案

#1


1  

You have ann error on line 4 :) Change this: $editare = "SELECT id, marca, model FROM modele WHERE id={$id};";

你在第4行有安全错误:)改变这个:$ editare =“SELECT id,marca,model FROM modele WHERE id = {$ id};”;

You forgot to read id too from table modele

你忘了从表格模式中读取id

#1


1  

You have ann error on line 4 :) Change this: $editare = "SELECT id, marca, model FROM modele WHERE id={$id};";

你在第4行有安全错误:)改变这个:$ editare =“SELECT id,marca,model FROM modele WHERE id = {$ id};”;

You forgot to read id too from table modele

你忘了从表格模式中读取id