-1
即時得到這個錯誤 警告:mysqli_error()期望的是1個參數,0 給我不明白爲什麼它給我的代碼是吹在這裏如何刪除mysqli的埃羅
<?php
// display add blog script and insert query
} else {
if(isset($_POST['submit']))
{
$heading = htmlentities($_POST['heading']);
$description = htmlentities($_POST['description']);
$heading = str_replace(' ', '-', $heading);
$cat_name = $_POST['blog_cat'];
$fileToUpload = basename($_FILES['fileToUpload']['name']);
$target_dir = "uploads/blog/";
$target_file = $target_dir.$fileToUpload;
$db_insert_image = "company_profile/".$target_file;
$date = date("y-m-d");
$query = mysqli_query($conn, "INSERT INTO blog SET heading='$heading',
description='$description', blog_cat='$cat_name', image='$db_insert_image',
author='$ename', status='1', created_date='$date'");
if ($query) {
if(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$target_file)) {
echo "<script>alert('Image uploaded.')</script>";
header("location:manageBlog.php");
exit();
} else {
echo "<script>alert('There was a problem uploading image.')</script>";
}
} else {
echo mysqli_error();
echo "<script>alert('There was a problem with query, please try again.')
</script>";
}
}
?>
'回聲mysqli_error($ conn);在'? – splash58
使用連接字符串作爲mysqli_error()的參數 –