你用类的的方法不行吗?
或者自己写啊
一样的:
<?php
$res="select * from ll"
$sql_select =mysql_query($res)//一样的,反正类只是进行了封装,实际上还是调用了这个函数
//.....
?>
//连接并选择数据库$mysqli = new mysqli("localhost", "my_user", "my_password", "my_db_name")
//如果连接失败
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error)
exit()
}
$sql = "SELECT * FROM admin where `username` = '$username'"
//query 后面都差不多
$result = $mysqli -> query($sql)
$uname = is_array($row = $result -> fetch_assoc())
$pwd = $uname ? $password == $row["password"] : FALSE
if($pwd){
$_SESSION["id"] = $row["id"]
$_SESSION["permit"] = $row["password"]
echo "OK!"
}else{
echo "Fail!"
session_destroy()
}
$mysqli->close()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)