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
相关问答:
用jsp做东西给完全不懂mysql的人用,可是备份时只有空文件,这是什么情况,
最好有源代码,谢谢
其实备份的过程我想大概是这样的:
将表A中的数据放到ArrayList中,然后将这个ArrayList中的数据再存到表B中。 ......
MYSQL 截取一个数据表中,某一个字段(fulltext) 的前三百个字符,放到该表下另一个字段(introtxt)里.
求实现这个效果的命令
SQL code:
update 表 set introtxt=left(`fulltext`,300);
顶,学习
SQL code: ......
需要在MySQL里面写个储存过程,
访问oracle的数据.
目前不能
oracle可以就可以连接mysql,通过odbc+dblink来连接
没有办法。目前的MYSQL的版本中尚不支持连接到其它数据库,
真挺有想法的 目前我没做过
......
今天搞 PHP 开发的时候,搞出了这个错误:
我执行的语句是:
INSERT INTO `tb_Replies`(`W_ID`,`R_Name`,`R_Contact`,`R_Content`) VALUES (98,'test','test','test');
......
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 '112,332,1113)values(123,321,123)' at line 1
insert ......