mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error());
mysql_select_db("mydb");$sql="Select UserName From Bk_User Where UserName=". $UserName
$result = mysql_query($sql);while (!$row = mysql_fetch_array($result, MYSQL_NUM)) {
       Call backerr("该用户已经存在,请使用其它用户名!")//这里是你自定义的操作
}    mysql_free_result($result);
?>

解决方案 »

  1.   

    因为手册中很少有现成的例子吧
    呵呵
    建议楼主去看看十天学会php类似的书
    coolwindkaka(寒の风) 的解释很标准,也很准确
      

  2.   

    $sql="Select UserName From Bk_User Where UserName=". $UserName;
    这一行少了一个;号,补上
      

  3.   

    $sql="Select UserName From Bk_User Where UserName=". $UserName;
    这一行少了一个;号,补上
    -----------------------------------------------------------------------
    应该是这样吧:
    $sql="Select UserName From Bk_User Where UserName= '". $UserName . "'";
      

  4.   

    网上很多有关php的入门资料,很方便就能搜到!加油!
      

  5.   

    Call backerr("该用户已经存在,请使用其它用户名!")//这里是你自定义的操作
    PHP没有CALL吧
      

  6.   

    $query="select username from bk_user where username='".$username."'";
    $rs=mysql_query($query);
    if(mysql_fetch_assoc($rs)){
    echo '该用户已经存在';

    这是通过其它朋友介绍的,觉得这个还比较容易理解些
    不过还是多谢各位的帮忙,真的