mysql数据查询问题
PHP code:
$query=mysql_query("select * from yonghu_t where yonghu_yhmm=$addusername");
if($query){
echo "<script>";
echo "alert(‘用户名已经存在’); window.history.go(-1);";
echo "</script>";
}else{
$sql="insert into yonghu_t (yonghu_yhmc,yonghu_yhmm,yonghu_yhsf,yonghu_lxfs,yonghu_yx,yonghu_jdsj) values('$addusername','$password1','$yhsf','$lxfs','$addemail',$time)";
echo "<br>".$sql;
$return=mysql_query($sql);
}
意思就是先查询,数据里面没有再插入!可是我每次执行。都插入到数据库了,这是为什么呢?
你的判断有问题
if($query)
"select * from yonghu_t where yonghu_yhmm=\"".$addusername."\""
"select * from yonghu_t where yonghu_yhmm=$addusername"====》"select * from yonghu_t where yonghu_yhmm='$addusername'"
mysql_query 的返回值 false不是查不到数据,而是你的sql语句有错误。
判断有没有,你可以写个sql语句
$query=mysql_query("select count(*) from yonghu_t where yonghu_yhmm=$addusername");
PHP code:
$sql = "se
相关问答:
如题,这三个在win7下使用会有什么兼容性问题吗?
由于我最近在使用win7,就懒得进xp了!
自己用windows 2008有一年多了,没出现任何问题。
win7测试版也用过,不会有什么问题的,放心。
当然你最 ......
一个行业网站,要实现的功能要求为:
一搜索表单可选搜索 产品/资讯/商家,搜索时希望先搜标题后全文,当前的数据量估计3万多,定位期望在百万级也可用。
数据类型为innodb,当前的方法是对关键词进行 ......
Winform+MySQL做项目,在注重性能的情况下,我该如何去完成这类型的项目呢!
请各位给以提示。
你这个范围太广了,我说2点重要的吧
1.WINFORM程序是单独运行的CS程序,和BS不同,BS的压力始终都在SERVER上的,对C ......
今天搞 PHP 开发的时候,搞出了这个错误:
我执行的语句是:
INSERT INTO `tb_Replies`(`W_ID`,`R_Name`,`R_Contact`,`R_Content`) VALUES (98,'test','test','test');
......