帮我看看数据库操作那块哪错了

Guevara-the-man 发布于 2013/04/23 12:07
阅读 112
收藏 0
PHP
<?php
require 'includes/ini.php';
if($_POST['imgcode'] != $_SESSION['yzcode']){
die('<script>alert("验证码有误");window.history.back();</script>');
}


$n = $_POST['uname'];
$p = md5($_POST['upassword']);
$sql ="SELECT * FROM net_admin WHERE uname = '$n' AND upassword = '$p' ";
$result = $db->query($sql);
if(!$result){
die("SQL执行失败,原因是:".mysql_error()."<p>语句是:$sql</p>");
}
$data = $db->fetch_row($result);
if($data){
$_SESSION['adminname'] = $_POST['uname'];
$_SESSION['id'] = $data['id'];
die("<script>alert('登陆成功');window.location='index.php'");
}else{
die("<script>alert('用户名或密码有误');window.history.back()");
}
加载中
0
疯狂的流浪
疯狂的流浪
提示什么错误啊大哥…
Guevara-the-man
Guevara-the-man
没提示错误就是数据库操作($data = $db->fetch_row($result))那里没返回值
0
Tuesday
Tuesday

echo mysql_error();

$data=$db->fetch_row($result);

返回顶部
顶部