[php]<?php
session_start();
include("conn/conn.php"); $sqls="select * from tb_user where username='".$username."' and userpwd='".$_POST[pwd]."'";$res=new com("adodb.recordset");$res->open($sqls,$conn,1,1);if(!$res->eof){
$sqls="update tb_user set userpwd='".$_POST[password]."'";
$rs=new com("adodb.recordset");
$rs->open($sqls,$conn,1,1);
if(!$res->eof){
echo "<script>alert('密码更新成功!');history.back();</script>";
}else{
echo "<script>alert('密码更新失败!');history.back();</script>";
}
}else{
echo "<script>alert('您输入的密码不正确!');history.back();</script>"; }
?>
[/php]这段访问ADOdb的程序怎么样访问 MYSQL???
session_start();
include("conn/conn.php"); $sqls="select * from tb_user where username='".$username."' and userpwd='".$_POST[pwd]."'";$res=new com("adodb.recordset");$res->open($sqls,$conn,1,1);if(!$res->eof){
$sqls="update tb_user set userpwd='".$_POST[password]."'";
$rs=new com("adodb.recordset");
$rs->open($sqls,$conn,1,1);
if(!$res->eof){
echo "<script>alert('密码更新成功!');history.back();</script>";
}else{
echo "<script>alert('密码更新失败!');history.back();</script>";
}
}else{
echo "<script>alert('您输入的密码不正确!');history.back();</script>"; }
?>
[/php]这段访问ADOdb的程序怎么样访问 MYSQL???
session_start();
$conn=mysql_connect('localhost','root','password')or die("数据库连接失败!".mysql_error());
mysql_select_db('testdb',$conn);
$sqls="select * from tb_user where username='".$username."' and userpwd='".$_POST[pwd]."'";
$res=mysql_query($sqls,$conn);
if($res){
$sqls="update tb_user set userpwd='".$_POST[password]."'";
$rs=mysql_query($sql,$conn)
if($rs){
echo " <script>alert('密码更新成功!');history.back(); </script>";
}else{
echo " <script>alert('密码更新失败!');history.back(); </script>";
}
}else{
echo " <script>alert('您输入的密码不正确!');history.back(); </script>"; }