hi all,
in my insert project page wen i am above to insert project if the project size is greater than the allocated size then it should display some alert message,but my code not displaying anything.so please check my code.
Thank u.

<?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.248","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 "<script language='javascript'>
            alert('Cannot Add Project');
           </script>";
} 
                    
?>

everything is fine but the problem is with 'if' condition. i dont know why it is not allowing to insert project. instead of this
if($_SESSION[usedmemory] < $_SESSION[allocatedmemory])
if i keep as
if(120<150)
then it is working fine. i dont know wer the error is. so please check this.
i did like this also
echo "SESSION[usedmemory]"
echo "SESSION[allocated memory]" to know whether values are present or not. it is printing the values as 120 and 150.
so please verify this.
Thank u.

Hi,
Store that session value in some other variable .And pass that variable in if statement.

echo $usedmemory=$_SESSION['usedmemory'];
echo $allocatedmemory=$_SESSION['allocatedmemory'];
if($usedmemory<$allocatedmemory)
{
//code
}

Thank you,
Prem.

niths, Read forum rules.

Do not post threads with generic subjects such as "HELP ME" or "PROBLEM". Instead, clearly state a phrase describing the problem as the thread's title. Do not flood the forum by posting the same question more than once (ie in multiple forums).

Use your other thread.
Thread closed.

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.