流程如下,login(login.php) - >更改密碼(changepass.php),其中每個用戶必須更改密碼 - >在主頁(homepage.php)上重定向,用戶可以在其中查看他/她的accnt細節....我想在我的主頁上,是根據其信息或studentid與其完整的名稱迎接用戶,但只有我可以顯示的是用戶的學生ID,因爲我回聲會話。我的繼承人爲我homepage.php我如何根據學生ID獲取用戶數據或信息?
<?php session_start(); ?>
<?php require('connect/connect.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home Page</title>
<link href="mm_spa.css" rel="stylesheet" type="text/css" />
</head>
<body class="oneColElsCtrHdr">
<td width="487" valign="top">
<?php
// this is the session id where i could only get from the user(student id)
echo $_SESSION['username'];
$voter = $_SESSION['username'];
function getuserinfo($info){
$info_select = mysql_query ("SELECT `$info` FROM new_reg_student WHERE studid='$voter'");
//this is my line 116 which i got an error saying
//Warning: mysql_query() expects parameter 1 to be string,
//resource given in C:\xampp\htdocs\project\homepage.php on line 116
if ($query_get = mysql_query($info_select)) {
if ($result = mysql_result($query_get, 0, $info)) {
return $result;
}
}
}
$fname = getuserinfo('fname');
$lname = getuserinfo('lname');
echo 'hello '. $fname .' '.$lname.'';
?>
</td>
<div id="footer">
<p>Footer</p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
繼承人
thnks很多爵士....它真的幫助我 –
歡迎您... :) –