查询不起作用?这不是提交,我不能为我的生活找出原因

时间:2013-09-02 12:21:51

标签: php mysql database

此查询未提交。当我回显$ 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);
}

0 个答案:

没有答案