|
|
这是我的coding,
<?php
require("connection.php");
$do = $_GET['do'];
switch($do) {
case 'check_username_exists':
if(!get_magic_quotes_gpc()) {
$username = addslashes($_GET['username']);
}else{
$username = $_GET['username'];
}
$count = mysql_num_rows(mysql_query("SELECT * FROM signup WHERE username='".$username."'"));
if($count > 0) {
// User name not available
echo '<img src="cross.jpg" alt="" width="22" height="22" />';
}else{
// User name available
echo '<img src="check.png" alt="" width="22" height="22" />';
}
break;
default:
echo 'No action specified.';
break;
}
?>
当我跑我的网页的时候,会出现这个error
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
到底是什么问题呢? 还有当我的count > 0 的时候应该是去cross 的 图片,
可是无论我type 什么,他都是出现check 的图片,
又是怎么一回事呢??
各位高手帮帮忙!!!!
[ 本帖最后由 uglyboy 于 1-6-2009 05:13 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 23-5-2009 08:21 PM
|
显示全部楼层
不要将懒惰。分成2段做吧。
mysq_query 的 result 是 empty 的话会出现问题的哟。 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|