hi iam new to php.the query is when i login in a login page. i can see users under me. projects can be created by me. so when ever i create a project i wil get a popup of projectname, allocated memory,created by. The problem is created by should be automatically generated and my id should store in it. so for that i created sessions(userid) but stil it is not taking the value. so can any one please.....
<?php
ob_start();
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid);
$con=mysql_connect("10.70.1.50","invensis","invensis");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_myproject",$con);
$query= mysql_query("SELECT * FROM projects where createdby='$_SESSION[userid]'");
mysql_error();
$num=mysql_num_rows($query);
mysql_close($con);
?>
<html>
<body>
<table width="100%">
<tr><td> <img src="Logofinalcopy.gif">
</td></tr>
<tr>
<td bgcolor="aqua"><h2>Project Management</h2></td>
</tr></table>
<div><table>
<tr>
<td align="right" style="width: 1000px"> </td>
<td align="left" style="width: 177px"><a href="Projectmgmt.php" onclick="window.open('http://localhost/Project/projectcreation.php','popup','width=330,height=250,scrollbars=no,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=no,left=500,center=0,top=350')">Add Project</a></td>
</tr>
</table></div>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px">
<tr>
<th>projectid</th>
<th>projectname</th>
<th>allocatedmemory</th>
<th>createddate</th>
<th>updateddate</th>
<th>createdby</th>
</tr>
<?php
$i=0;
while ($i < $num){
$f1=mysql_result($query,$i,"projectid");
$f2=mysql_result($query,$i,"projectname");
$f3=mysql_result($query,$i,"allocatedmemory");
$f4=mysql_result($query,$i,"createddate");
$f5=mysql_result($query,$i,"updateddate");
$f6=mysql_result($query,$i,"createdby");
?>
<tr>
<td><?php echo $f1;?></td>
<td><?php echo $f2; ?></td>
<td><?php echo $f3; ?></td>
<td><?php echo $f4;$today = mktime(date("y"),date("m"),date("d"));
echo date("Y/m/d", $today); ?></td>
<td><?php echo $f5;$today = mktime(date("y"),date("m"),date("d"));
echo date("Y/m/d", $today); ?></td>
<td><?php echo $userid;?></td>
<td><a href =http://localhost/Project/Projectmgmt.php onclick="window.open('http://localhost/Project/updateproject.php?f1=<?php echo $f1;?>','popup','width=350,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=no,left=500,center=0,top=350')">
edit</a></td>
</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>