php session对象创建报错
header("content-type:text/html;charset=utf-8");
include("conn.php");
session_start();
$Loname=trim($_POST["Loname"]);
$Lopass=trim($_POST["Lopass"]);
$Losx=trim($_POST["Losx"]);
$Locode=trim($_POST["Locode"]);
if (strlen($Locode)echo "请输入验证码";
exit;
}
if (trim($_SESSION['validationcode'])!=$Locode){
echo "验证码输入错误";
exit;
}
if (strlen($Loname)echo "请输入用户名";
exit;
}
if (strlen($Lopass)echo "请输入密码";
exit;
}
if (strlen($Losx)echo "请输入密令";
exit;
}
if ($Losx!="first_admin")
{
echo "密令错误";
exit;
}
mysql_query("set names utf8");
mysql_select_db("first_data",$con);
$Lopassx=md5($Lopass);
$sql="select * from admin_infox where admin_name='$Loname' and admin_pass='$Lopassx' and ck_working=1";
$result = mysql_query($sql);
[email protected]_num_rows($result);
if (!$row){
echo "账号信息出错";
exit;
}
else
{
$_SESSION['admin_namex']=$result("admin_name");
$_SESSION['admin_power']=$result("admin_powerx");
$_SESSION['admin_cking']="working";header('location:index_home.php');
}
mysql_close($con);
?>
我验证用户之后创建session 结果报错说
Fatal error: Function name must be a string in D:\wamp\www\first_line\administrators\inc\login_ck.php on line 49
高人指点指点 谢谢
------解决方案--------------------
$result("admin_name"); 这不对吧。 $result不是资源集吗、
------解决方案--------------------
$result是个数据库资源标识符,,所以你应该mysql_fetch_assoc……获取数据
然后获取$result("admin_name");数组元素下标用[]
------解决方案--------------------
$rowx["admin_name"]; 下面的一样。
------解决方案--------------------
$row = mysql_fetch_assoc($result);
$_SESSION['admin_namex']=$row['admin_name'];
$_SESSION['admin_power']=$row['admin_powerx'];