此查询未提交。当我回显$ qry并手动运行代码时,它可以工作,但这段代码只是没有提交查询,我不知道为什么。我做错了什么?
$qry = "INSERT INTO comments (time, commenter, location, party, thereisimg, imgtype, imgwidth, imgheight) VALUES ('$datetime', '$email', '$partyid', '1', '1', '$file_ext', '".$img_size["width"]."', '".$img_size["height"]."')";
echo $qry;
$result = mysqli_query($dblink, $qry) or die(mysqli_error($dblink));
以下是一些代码。 $ iscomment设置为false。
$img = new imagick($file_tmp);
$img_size = $img->getImageGeometry();
$resized = 0;
if ($img_size["width"] > 600 || $img_size["height"] > 600) {
// resize image
$img->resizeImage(600, 600, imagick::FILTER_LANCZOS, 0.9, true);
$img_size = $img->getImageGeometry();
$resized = 1;
}
if ($iscomment) {
// update database
$qry = "UPDATE comments SET thereisimg=1, imgtype='".$file_ext."', imgwidth='".$img_size["width"]."', imgheight='".$img_size["height"]."' WHERE id=$id";
$result = mysqli_query($dblink, $qry) or die(mysqli_error($dblink));
} else {
$qry = "INSERT INTO comments (time, commenter, location, party, thereisimg, imgtype, imgwidth, imgheight) VALUES ('$datetime', '$email', '$partyid', '1', '1', '$file_ext', '".$img_size["width"]."', '".$img_size["height"]."')";
echo $qry;
$result = mysqli_query($dblink, $qry) or die(mysqli_error($dblink));
echo "<br />"."1";
$id = mysqli_insert_id($dblink);
}