When a user logs in to my manager/add page i have a table that is supose to pull off only the information tied to the users id. if another user logs in the page should look at that users id and pull up different information. The registerd users are in a table title 'users' where they have a field titled 'id' the information being pulled is in a table titled 'collegiate' where there is a field 'id' and a field called 'user_id' it is the user_id that is equal to the id in the users table 'id' field. I am having trouble connecting everything together. Because when a user logs in he sees everyones data in the collegiate table and not his own. Below is the code that i have. If anyone has suggestions I would be greatful.
<?php
include($_SERVER['DOCUMENT_ROOT']."/users/ext_user_profile.php");
error_reporting (E_ALL); // I use this only for testing
$update_profile = new Users_profile;
$update_profile->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']); // protect this page too.
//$update_profile->get_profile_data();
$error = $update_profile->the_msg; // error message
?>
<html>
<head>
<title>Admin Page For Content Management System (CMS)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function delArticle(id, first)
{
if (confirm("Are you sure you want to delete '" + first + "'"))
{
window.location.href = 'cms-admin.php?del=' + id;
}
}
</script>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999">
<tr align="center" bgcolor="#CCCCCC">
<td width="500"><strong>Title</strong></td>
<td width="150"><strong>Action</strong></td>
</tr>
<?php
//pulls information form both tables and connects by id and user_id
$log_user = $_SESSION['user'];
$result = mysql_query("SELECT first FROM collegiate, users WHERE collegiate.user_id=users.id") or die('Error : ' . mysql_error());
echo "$log_user";
while(list($first) = mysql_fetch_array($result))
{
?>
<tr bgcolor="#FFFFFF">
<td width="500">
<?php echo $first;?>
</td>
<td width="150" align="center"><a href="article2.php?id=<?php echo $id;?>" target="_blank">view</a>
| <a href="cms-edit.php?id=<?php echo $id;?>">edit</a> | <a href="java script:delArticle('<?php echo $id;?>', '<?php echo $first;?>');">delete</a></td>
</tr>
<?php
}
?>
</table>
<p align="center"><a href="cms-add.php">Add an article</a></p>
</body>
</html>