Fatal error: Call to a member function query() on a non-object in F:\zhuc\new_file.php on line 3
<?php$conn=@mysql_connect("localhost","root","123456");$conn->query('setnamesgb2312')...
<?php
$conn=@mysql_connect("localhost","root","123456");
$conn->query('set names gb2312');
if(!$conn){
echo "没连接上";
}
$conn=@mysql_select_db("xh_user");
if(!$conn){
echo "没找到数据库";
}
$UserName=$_POST['username'];
$pwd=$_POST['password'];
$email=$_POST['email'];
$code=strtolower($_POST["code"]);
$str="select * from users where username='".$username."'";
$result1=$conn->query($str);
$row=$result1->fetch_row();
if($row)
{
$temp="已有人注册此名,请重新选择名字!";
echo $temp;
echo"<a href=zhuce.php>返回</a>";
}
else {
if( $_SESSION['sname']==$code)
{
echo $temp="认证码成功";
$sql="INSERT INTO `{$this->dbprefix}user` VALUES('$username', '$password')";
$result=$conn->query($sql);
if($result==true)
{
$_SESSION['mail']="注册成功,请登陆";
echo "<script>window.location.href='login1.php'</script>";
}
else {echo "注册失败".mysql_error();}
}
else {echo "认证码错误";}
}
?>
那里错了? 展开
$conn=@mysql_connect("localhost","root","123456");
$conn->query('set names gb2312');
if(!$conn){
echo "没连接上";
}
$conn=@mysql_select_db("xh_user");
if(!$conn){
echo "没找到数据库";
}
$UserName=$_POST['username'];
$pwd=$_POST['password'];
$email=$_POST['email'];
$code=strtolower($_POST["code"]);
$str="select * from users where username='".$username."'";
$result1=$conn->query($str);
$row=$result1->fetch_row();
if($row)
{
$temp="已有人注册此名,请重新选择名字!";
echo $temp;
echo"<a href=zhuce.php>返回</a>";
}
else {
if( $_SESSION['sname']==$code)
{
echo $temp="认证码成功";
$sql="INSERT INTO `{$this->dbprefix}user` VALUES('$username', '$password')";
$result=$conn->query($sql);
if($result==true)
{
$_SESSION['mail']="注册成功,请登陆";
echo "<script>window.location.href='login1.php'</script>";
}
else {echo "注册失败".mysql_error();}
}
else {echo "认证码错误";}
}
?>
那里错了? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询