我删除了只有一个插入的查询
<?php
session_start();
include 'cstring.php';
$title="";
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else {
$title=$_POST['title'];
$query=mysqli_query($con,"insert into blogpages(blogpagetitle) values('".$title."')");
if($query){
$bloga="sucessfully added a new blog";
echo $bloga;
}
else {
echo mysqli_error($con); // if using mysqli do not use mysql in between
}
}
mysqli_close($con);
?>
这段代码中有什么东西它没有插入到mysql中
表格结构
1.bpid int(50)-------------- null-no default-none autoincrement
2.blogpagetitle ------------ varchar(255)utf16_general_ci
3.datemade ------------- timestamp当前时间戳
4.blogpagedescription --------- text utf16_general_ci
5.blogbody ---------------- longtext utf16_general_ci
6.blogpageextended ------------ text utf16_general_ci
答案 0 :(得分:1)
提示强>
答案 1 :(得分:0)
您应该使用echo mysql i _error($ con)来获取错误消息而不是mysql_error()。