首页上一页 1 下一页尾页 2 条记录 1/1页
PHP开发实例宝典 程序运行错误
发表在PHP图书答疑
2011-03-30
是否精华
是
否
版块置顶:
是
否
P533页,主要程序如下
<?php
$fp1=mysql_connect("localhost","****","****") or die("数据库连接失败".mysql_error()) ;
$result=mysql_select_db("test",$fp1)or die("数据库选择失败".mysql_error());
$file=$_POST[file];
$fp=fopen($_POST[file],"r");
$file=fread($fp,filesize($_POST[file]));
$query="insert into tb_tpsc(tpmc,file) values('$_POST[tpmc]','$file')";
$result=mysql_query($query)or die("数据插入失败".mysql_error());
echo $result."<br>";
echo $file;
?>
得出结果:数据插入失败You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
<?php
$fp1=mysql_connect("localhost","****","****") or die("数据库连接失败".mysql_error()) ;
$result=mysql_select_db("test",$fp1)or die("数据库选择失败".mysql_error());
$file=$_POST[file];
$fp=fopen($_POST[file],"r");
$file=fread($fp,filesize($_POST[file]));
$query="insert into tb_tpsc(tpmc,file) values('$_POST[tpmc]','$file')";
$result=mysql_query($query)or die("数据插入失败".mysql_error());
echo $result."<br>";
echo $file;
?>
得出结果:数据插入失败You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz