hi all,
i am allocating some memory for projects. if any one add a project and if its memory is greater than allocated memory, then the project should not add. so please help me.
Thank u.

<script language="javascript" type="text/javascript">
window.close();
</script> 
<?php
$id=$_GET['f1'];
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory);
$con=mysql_connect("10.70.1.50","invensis","invensis");
if(!$con)
	{
		die('Could not connect: ' . mysql_error());
	}
mysql_select_db("database_myproject",$con);
if($_SESSION[usedmemory] < $_SESSION[allocatedmemory])
{
$sql="INSERT INTO projects(projectname,allocatedmemory,createdby)
VALUES ('$_POST[projectname]','$_POST[allocatedmemory] $_POST[size]','$_SESSION[username]')
";
echo "New Project Added";
if(!mysql_query($sql,$con))
 {
 	die('Error:' . mysql_error());
 }
}
else  
{
"echo cannot add project"; 
}
?>

Two question on this one,
1) Shouldn't the strings within the $_SESSION[] markers be single quoted?
2) Aren't these SESSION variables? i.e. they give the information relevant to that particular session and not the total memory used. So USEDMEMORY should always be less than ALLOCATEDMEMORY.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.