$conn=@mysql_connect("localhost","root");
$sql=@mysql_select_db("Jocky",$conn);
$query="select * from user1 where name='$name'";
$result=mysql_query($query);
if(!$result)
{
echo "sql语句错误!";
}
else
{
$num_rows=mysql_num_rows($result);
if($num_rows>0)
{
echo"<br><center><font color=blue>对不起,已经有相同的用户名!请</font><a href=zcyh.php>返回</a>.</center><br>";
include("include/common.inc");
include("include/footer.inc");
}
else
{
$conn=@mysql_connect("localhost","root");
$sql=@mysql_select_db("Jocky",$conn);
$sqldo="insert into user1 values ('".$name."')";
@mysql_query($sqldo,$conn);
echo "你好,".$name."!请点"."<a href=check.php>下一步</a>"."填写注册信息";
@mysql_close($conn);
include("include/common.inc");
include("include/footer.inc");
exit();
}
这是连接数据库的部分,其他的自己写。多看PHP手册,MYAQL手册。
$sql=@mysql_select_db("Jocky",$conn);
$query="select * from user1 where name='$name'";
$result=mysql_query($query);
if(!$result)
{
echo "sql语句错误!";
}
else
{
$num_rows=mysql_num_rows($result);
if($num_rows>0)
{
echo"<br><center><font color=blue>对不起,已经有相同的用户名!请</font><a href=zcyh.php>返回</a>.</center><br>";
include("include/common.inc");
include("include/footer.inc");
}
else
{
$conn=@mysql_connect("localhost","root");
$sql=@mysql_select_db("Jocky",$conn);
$sqldo="insert into user1 values ('".$name."')";
@mysql_query($sqldo,$conn);
echo "你好,".$name."!请点"."<a href=check.php>下一步</a>"."填写注册信息";
@mysql_close($conn);
include("include/common.inc");
include("include/footer.inc");
exit();
}
这是连接数据库的部分,其他的自己写。多看PHP手册,MYAQL手册。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货