0

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"; 
}
?>
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by pclfw
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.