有没有PHP的注册页的例子啊。..
解决方案 »
- php的简单问题
- responseXML无法取得结果
- 这个正则语句怎么写
- 怎样在eclipse中安装phpeclipse插件不能用
- 怎么我的浏览器地址栏的url会变?
- 一用迅雷就断网,怎么回事??
- php连mysql,并取数据。
- 各位:重分请教小问题!关于phpmyadmin的安装!!!! 谢谢大家!小弟在线等待!!小弟在线等待!!小弟在线等待!!
- 有谁知道阿里吧吧是用什么语言做的啊?
- 求解一段代码,比较费解
- Incorrect string value: '\xBC\xD3\xCB\xD9\xD2\xB3...' 无语的错误
- 100分悬赏! PHP做周历,谁有做好的代码?或者提供我周历的算法也行!
$user="root";
$password="123456";
$db="mydb";
function db_connect($user,$password,$db){
mysql_connect($localhost, $user, $password) //链接函数
or die('I cannot connect to db: ' . mysql_error()); //链接失败将返回错误信息
mysql_select_db($db); //选择使用的数据库
} db_connect(); //打开数据库第二步:数据库操作:1、插入数据$sql = "insert into users (username, email, password) values ('".$_POST["name"]."', '".$_POST["email"]."', '".$passwords[0]."')";
$result = mysql_query($sql); //得到查询结果
if ($result){
echo "It's entered!";
} else {
echo "There's been a problem: ".mysql_error();
} 2、查询并显示数据$sqlAll = "select * from users";
$result = mysql_query($sqlAll);
$row = mysql_fetch_array($result); //得到记录集的一行,放到数组row中
while ($row) {
echo $row["username"]." -- ".$row["email"]."<br />";
} 第三步:释放并关闭数据库链接@mysql_free_result($result);mysql_close();//执行完后关闭数据库
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>增加用户</title>
<style type="text/css">
<!--
.STYLE1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
if($_POST['submit'])
{
$wyx_name=$_POST['wyx_name'];
$wyx_pass=md5(trim($_POST['wyx_pass1']));
$sql="INSERT INTO wyx_user (wyx_name,wyx_pass) VALUES ('$wyx_name','$wyx_pass')";
$result=mysql_query($sql);
header("Location:admin_user.php");
}
else
{
?>
<form method="post" name="form1" action="<?php echo $PATH_INFO;?>">
<table width="400" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#666666">
<tr>
<td colspan="2" align="center" bgcolor="#666666" class="STYLE1">增加新用户</td>
</tr>
<tr>
<td width="150" align="right" bgcolor="#FFFFFF">用户名:</td>
<td width="250" bgcolor="#FFFFFF"><input name="wyx_name" type="text" size="17"/>
<font color=red>*</font></td>
</tr>
<tr>
<td width="150" align="right" bgcolor="#FFFFFF">密码:</td>
<td width="250" bgcolor="#FFFFFF">
<input name="wyx_pass1" type="password" size="18"/> <font color=red>*</font></td>
</tr>
<tr>
<td width="150" align="right" bgcolor="#FFFFFF">重复密码:</td>
<td width="250" bgcolor="#FFFFFF">
<input name="wyx_pass2" type="password" size="18"/> <font color=red>*</font></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" value="提交" /></td>
</tr>
</table>
</form>
<?php
}
?>
</body>这个没有对两次输入的密码进行验证
连接数据库的代码就不要我写了吧