Displaying user information on user profile page
I am designing a site that manages student database, trying to create a profile page that displays each student information on logging on with each unique username and password. on log on, it displays an empty record. below is my profile page code:
<?php require_once('Connections/fedponam.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_getUser = "-1";
if (isset($_GET['username'])) {
$colname_getUser = $_GET['username'];
}
mysql_select_db($database_fedponam, $fedponam);
$query_getUser = sprintf("SELECT userid, fullname, address, dateofbirth, gender, maritalstatus, regno, department, course, yearofentry, currentlevel, emailaddress, phoneno, association, hobby, nextofkin, image, quote, username FROM useraccount WHERE username = %s", GetSQLValueString($colname_getUser, "text"));
$getUser = mysql_query($query_getUser, $fedponam) or die(mysql_error());
$row_getUser = mysql_fetch_assoc($getUser);
$totalRows_getUser = mysql_num_rows($getUser);
?>
<!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>::: Title :::</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script language="JavaScript1.2" type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<script language="JavaScript1.2" type="text/javascript" src="mm_css_menu.js"></script>
<style type="text/css">
@import url("img/menubb.css");
body {
margin-left: 0px;
}
h3 {
font-size: 16px;
color: #C60;
}td img {display: block;}td img {display: block;}td img {display: block;}td img {display: block;}td img {display: block;}td img {display: block;}td img {display: block;}td img {display: block;}
</style>
<style type="text/css" media="screen">
@import url("menubarFW.css");
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
h1 {
font-size: 24px;
}
h4 {
font-size: 18px;
color: #060;
}
</style>
</head>
<body bgcolor="#000000"><div class="top"></div>
<div class="container">
<div class="newsflash">
<font color="#FF0000"><b>Newsflash:</b></font></div>
<div class="newsflashitem">
<marquee direction="left" scrollamount="3"><b>bla bla bla</b></marquee>
</div>
<div class="header"><img src="img/header.jpg" width="968" height="104" alt="header" /></div>
<div class="menubar">
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="index.php">Home</a> </li>
<li><a href="#" class="MenuBarItemSubmenu">Fedponam</a>
<ul>
<li><a href="fedponam.php">Management</a></li>
<li><a href="#">Lecturers</a></li>
<li><a href="listofschools.php">Departments</a></li>
<li><a href="#">Exam Timetable</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">The SUG</a>
<ul>
<li><a href="sugexec.php">Executive</a></li>
<li><a href="#">Parliament</a></li>
</ul>
</li>
<li><a href="studentlist.php">StudentDirectory</a></li>
<li><a href="#" class="MenuBarItemSubmenu">Assesments</a>
<ul>
<li><a href="loginaccessment.php">Results</a></li>
</ul>
</li>
<li><a href="#">Publications</a></li>
<li><a href="#">Alumni</a></li>
<li><a href="/index.php">Our Community</a> </li>
<li><a href="#">E-Library</a></li>
</ul>
</div>
<div class="pixslide">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="966" height="303" id="FlashID" title="m">
<param name="movie" value="img/Movie1.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="img/Movie1.swf" width="966" height="303">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
<div class="container3">
<div class="contentform">
<p>[Edit Profile] [logout]</p>
<form id="form1" name="form1" method="post" action="">
<table width="920" bgcolor="#FFFFFF" border="1" bordercolor="#000000">
<tr>
<td rowspan="16" width="160"><img src="<?php echo $row_getUser['image']; ?>" alt="" name="image" id="image" /></td>
<td width="180"><strong>Fullname:</strong></td>
<td><?php echo $row_getUser['fullname']; ?></td>
</tr>
<tr>
<td><strong>Address:</strong></td>
<td><?php echo $row_getUser['address']; ?></td>
</tr>
<tr>
<td><strong>Date of Birth:</strong></td>
<td><?php echo $row_getUser['dateofbirth']; ?></td>
</tr>
<tr>
<td><strong>Gender:</strong></td>
<td><?php echo $row_getUser['gender']; ?></td>
</tr>
<tr>
<td><strong>Marital Status:</strong></td>
<td><?php echo $row_getUser['maritalstatus']; ?></td>
</tr>
<tr>
<td><strong>Registration No.:</strong></td>
<td><?php echo $row_getUser['regno']; ?></td>
</tr>
<tr>
<td><strong>Department:</strong></td>
<td><?php echo $row_getUser['department']; ?></td>
</tr>
<tr>
<td><strong>Course:</strong></td>
<td><?php echo $row_getUser['course']; ?></td>
</tr>
<tr>
<td><strong>Year of Entry:</strong></td>
<td><?php echo $row_getUser['yearofentry']; ?></td>
</tr>
<tr>
<td><strong>Current Level:</strong></td>
<td><?php echo $row_getUser['currentlevel']; ?></td>
</tr>
<tr>
<td><strong>Email Add:</strong></td>
<td><?php echo $row_getUser['emailaddress']; ?></td>
</tr>
<tr>
<td><strong>Phone No.:</strong></td>
<td><?php echo $row_getUser['phoneno']; ?></td>
</tr>
<tr>
<td><strong>Association:</strong></td>
<td><?php echo $row_getUser['association']; ?></td>
</tr>
<tr>
<td><strong>Hobby:</strong></td>
<td><?php echo $row_getUser['hobby']; ?></td>
</tr>
<tr>
<td><strong>Favorite Quote:</strong></td>
<td><?php echo $row_getUser['quote']; ?></td>
</tr>
<tr>
<td><strong>Username:</strong></td>
<td><?php echo $row_getUser['username']; ?></td>
</tr>
</table>
</form>
<h1> </h1>
<h4> </h4>
<h3> </h3>
</div>
</div></div>
<div class="footer">
<div class="column1"><h2>Recent News<hr /></h2>
<p><marquee direction="up" scrollamount="2" height="185">bla bla bla.</marquee></p>
</div>
<div class="column2"><h2>Who is Online<hr /></h2>
<p>_______________________________________<br />
_______________________________________<br />
_______________________________________<br />
_______________________________________<br />
_______________________________________<br /></p>
</div>
<div class="column3"><h2>Find us on<hr /></h2>
<p><img src="img/facebook-logo.jpg" width="165" height="30" alt="fb" /></p>
<p><img src="img/Follow Us on twitter.png" width="154" height="33" alt="tw" /></p>
<p><img src="img/YouTube_logo.png" width="107" height="34" alt="yt" /> <img src="img/gtalk.png" width="89" height="36" alt="gt" /><br />
</p>
</div>
</div>
<div class="footer2">Powered by: <b><i>Furqan Global Concept Ltd.</i> 08036592925. <a href="admin/login.php">Admin</a></b></div>
<script type="text/javascript">
swfobject.registerObject("FlashID");
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>
<?php
mysql_free_result($getUser);
?>