<?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儎厗噲墛挀敃枟槞殺¥ウЖ┆渤吹斗腹郝媚' at line 1
发现$file 输出的是乱码,不是01001的形式,怎么解决?
$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儎厗噲墛挀敃枟槞殺¥ウЖ┆渤吹斗腹郝媚' at line 1
发现$file 输出的是乱码,不是01001的形式,怎么解决?
$result=mysql_query($query)or die("数据插入失败".mysql_error());