mysql_select_db('studentsystem') or die("无法选择数据库,请重试")
$set="select * from manager where username='".$_POST['username']."'
and password='".$_POST['pass']."'"
////重点在这里
$Result = mysql_query($set)// 结果集
$rows= mysql_fetch_array($Result,MYSQL_ASSOC) //读取数据
////重点在这里
if($rows){
echo "成功"
}else {
echo '不成功'
}
mysql_free_result($Result)
$conn = mysql_connect("localhost","root","")mysql_select_db("homework", $conn)
mysql_query("SET NAMES 'UTF8'",$conn)
$username=$_POST['user_email']
$password=$_POST['password']
$sql = "select * from user where username='$username' and password='$password'"
$Result = mysql_query($sql, $conn)
$onerow = mysql_fetch_array($Result)
if ( $onerow )
echo "正确"
else
echo "错误"
1、在网站配置的根目录新建一个index.php文件;
2、内容输入:
<?php phpinfo()
$link = mysql_connect ( 'localhost' , 'mysql_user' , 'mysql_password' )
if (! $link ) {
die( 'Could not connect: ' . mysql_error ())
}else{
echo 'mysql test successful.'
}
} ?>
,保存;
3、在浏览器中输入localhost,访问,若出现一长页的php的各种安装信息,则证明该nginx服务器已安装成功,反之则失败,若出现mysql test successfull.则mysql建立连接成功,反之则有两种情况,一是mysql用户名或密码错误(此种可能较大),二是mysql安装失败。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)