## I want to Convert this Mysqli code to the Pdo
## 这是Mysqli代码,其中我根据条件分割查询 我想在PDO中做到这一点
$query="UPDATE sitetext SET text1 = '$sitetext', email = '$email'";
if(isset($logo))
{
$query.=",logo='$logo' WHERE id = 1";
}
else
{
$query.=" WHERE id = 1";
}
$result=mysqli_query($conn,$query);
答案 0 :(得分:-1)
只需用PDO :: exec更改mysqli_exec?
$query="UPDATE sitetext SET text1 = '$sitetext', email = '$email'";
if(isset($logo))
{
$query.=",logo='$logo' WHERE id = 1";
}
else
{
$query.=" WHERE id = 1";
}
$result= $PDO_Object->exec($query);