Home > Backend Development > PHP Tutorial > php没法重数据库内读出用户信息来 求解

php没法重数据库内读出用户信息来 求解

WBOY
Release: 2016-06-13 12:48:03
Original
786 people have browsed it

php无法重数据库内读出用户信息来 求解
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



个人中心



session_start();
if(!isset($_SESSION['UID'])){
header("Location:login.html");
    exit();
}
include('conn.php');
$userid = $_SESSION['UID'];
$username = $_SESSION['username'];
$user_query = mysql_query("select * from zhuce where Uid=$userid limit 1");
$row =  mysql_fetch_row($user_query);
echo '用户信息:
';
echo '用户ID:',$userid,'
';
echo '用户名:',$username,'
';
echo '邮箱:',$row['Mail'],'
';
echo '出生日期: ',$row['Birthday'],'
';
echo '固定电话: ',$row['Phone'],'
';
echo '手机: ',$row['Mobile_telephone'],'
';
echo '注册日期: ',$row['Date'],'
';
echo '注销 登录
';
?>




------解决方案--------------------
$row =  mysql_fetch_row($user_query);
得到的是下标数组
你用关联数组的方式如$row['Mail'],自然就得不到数据了
需要这样 $row[0]、$row[1] ....

这样
$row =  mysql_fetch_assoc($user_query);
才可以
$row['Mail']、$row['Phone'] ....
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template