php session对象创建报错
<?php
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)<=0 ){
echo "<font color=red>请输入验证码</font>";
exit;
}
if (trim($_SESSION['validationcode'])!=$Locode){
echo "<font color=red>验证码输入错误</font>";
exit;
}
if (strlen($Loname)<=0 ){
echo "<font color=red>请输入用户名</font>";
exit;
}
if (strlen($Lopass)<=0 ){
echo "<font color=red>请输入密码</font>";
exit;
}
if (strlen($Losx)<=0 ){
echo "<font color=red>请输入密令</font>";
exit;
}
if ($Losx!="first_admin")
{
echo "<font color=red>密令错误</font>";
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);
$row=@mysql_num_rows($result);
if (!$row){
echo "<font color=red>账号信息出错</font>";
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'];