php数据无法存入数据库
这是表单<html><head><metacontent="text/html;charset=gb2312"http-equiv="Content-Type"></he...
这是表单
<html>
<head>
<meta content="text/html;charset=gb2312"http-equiv="Content-Type">
</head>
<body>
<form name="form1" action="animation_manager.php" method="POST">
<p>id: <input type="text" name="id" size="6" id="id"></input></p>
<p>title:<input type="text" name="title" size="10" id="title"></input></p>
<p>thumbnail:<input type="text" name="thumbnail" size="8" id="thumbnail"></input></p>
<p>infopage: <input type="text" name="infopage" size="8" id="infopage"></input></p>
<p>url:<input type="text" name="url" size="20" id="url"></input></p>
<p>status:<input type="text" name="status" size="20" id="status"></input></p>
<p>hdsd:<input type="text" name="hdsd" size="20" id="hdsd"></input></p>
<p>rating:<input type="text" name="rating" size="20" id="rating"></input></p>
<p>site:<input type="text" name="site" size="20" id="site"></input></p>
<p>actor:<input type="text" name="actor" size="20" id="actor"></input></p>
<p>alias:<input type="text" name="alias" size="20" id="alias"></input></p>
<p>pubDate:<input type="text" name="pubDate" size="20" id="pubDate"></input></p>
<p>alias:<input type="text" name="area" size="20" id="area"></input></p>
<p>types:<input type="text" name="types" size="20" id="types"></input></p>
<p>director:<input type="text" name="director" size="20" id="director"></input></p>
<p>detail:<input type="text" name="detail" size="20" id="detail"></input></p>
<p><input type="submit" name="submit" value="提交"></input></p>
</form>
</body>
</html>
这是处理文件
<?php
error_reporting(E_ALL & ~ E_NOTICE);
//insert into
include'config.php';
$id = $_POST["id"];
$title = $_POST["title"];
$thumbnail = $_POST["thumbnail"];
$infopage = $_POST["infopage"];
$url = $_POST["url"];
$status = $_POST["status"];
$hdsd = $_POST["hdsd"];
$rating = $_POST["rating"];
$site = $_POST["site"];
$actor = $_POST["actor"];
$alias = $_POST["alias"];
$pubDate = $_POST["pubDate"];
$area = $_POST["area"];
$types = $_POST["types"];
$director = $_POST["director"];
$detail = $_POST["detail"];
if ($$error==false)
{
$query="insert into tbl_animation (id, title, thumbnail,infopage, url, status, hdsd, rating,site,actor,alias,pubDate,area,types,director,detail) values('id','title','$thumbnail','$infopage','$url','$status','$hdsd','$rating','$site','$actor','$alias','$pubDate','$area','$types','$director','$detail')";
$result=mysql_query($query);
}
?> 展开
<html>
<head>
<meta content="text/html;charset=gb2312"http-equiv="Content-Type">
</head>
<body>
<form name="form1" action="animation_manager.php" method="POST">
<p>id: <input type="text" name="id" size="6" id="id"></input></p>
<p>title:<input type="text" name="title" size="10" id="title"></input></p>
<p>thumbnail:<input type="text" name="thumbnail" size="8" id="thumbnail"></input></p>
<p>infopage: <input type="text" name="infopage" size="8" id="infopage"></input></p>
<p>url:<input type="text" name="url" size="20" id="url"></input></p>
<p>status:<input type="text" name="status" size="20" id="status"></input></p>
<p>hdsd:<input type="text" name="hdsd" size="20" id="hdsd"></input></p>
<p>rating:<input type="text" name="rating" size="20" id="rating"></input></p>
<p>site:<input type="text" name="site" size="20" id="site"></input></p>
<p>actor:<input type="text" name="actor" size="20" id="actor"></input></p>
<p>alias:<input type="text" name="alias" size="20" id="alias"></input></p>
<p>pubDate:<input type="text" name="pubDate" size="20" id="pubDate"></input></p>
<p>alias:<input type="text" name="area" size="20" id="area"></input></p>
<p>types:<input type="text" name="types" size="20" id="types"></input></p>
<p>director:<input type="text" name="director" size="20" id="director"></input></p>
<p>detail:<input type="text" name="detail" size="20" id="detail"></input></p>
<p><input type="submit" name="submit" value="提交"></input></p>
</form>
</body>
</html>
这是处理文件
<?php
error_reporting(E_ALL & ~ E_NOTICE);
//insert into
include'config.php';
$id = $_POST["id"];
$title = $_POST["title"];
$thumbnail = $_POST["thumbnail"];
$infopage = $_POST["infopage"];
$url = $_POST["url"];
$status = $_POST["status"];
$hdsd = $_POST["hdsd"];
$rating = $_POST["rating"];
$site = $_POST["site"];
$actor = $_POST["actor"];
$alias = $_POST["alias"];
$pubDate = $_POST["pubDate"];
$area = $_POST["area"];
$types = $_POST["types"];
$director = $_POST["director"];
$detail = $_POST["detail"];
if ($$error==false)
{
$query="insert into tbl_animation (id, title, thumbnail,infopage, url, status, hdsd, rating,site,actor,alias,pubDate,area,types,director,detail) values('id','title','$thumbnail','$infopage','$url','$status','$hdsd','$rating','$site','$actor','$alias','$pubDate','$area','$types','$director','$detail')";
$result=mysql_query($query);
}
?> 展开
3个回答
展开全部
insert into tbl_animation (id, title, thumbnail,infopage, url, status, hdsd, rating,site,actor,alias,pubDate,area,types,director,detail)
这段代码里面的字段必须和数据库里面的字段必须一样。
检查一下,如果不行,就看输入的数据是否数据类型不匹配。
这段代码里面的字段必须和数据库里面的字段必须一样。
检查一下,如果不行,就看输入的数据是否数据类型不匹配。
追问
sql语句验证过了 没错
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
if ($$error==false) 这里error前面2个$$符号
追问
把这个判定语句都不要了 也不好用
追答
sql 语句 values('id','title', 中的id和title前面没加$
还有就是查看下数据库是否连接正常
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询