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.

require_once ("check.php");
		die('Could not connect: ' . mysql_error());
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";
 	die('Error:' . mysql_error());
echo "<script language='javascript'>
            alert('Cannot Add Project');

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
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.

Recommended Answers

I think this kind of advertisements are not allowed between other threads.

Jump to Post

All 4 Replies

Well for starters you seem to have 4 values in the VALUES clause but only three columns in the INSERT clause.

The named values in the line

if($_SESSION[usedmemory] < $_SESSION[allocatedmemory])

should be quoted.

See http://uk3.php.net/manual/en/language.variables.predefined.php


We need LAMP programmers with 4,5 years experience. We are primarily working on xklsv.com, a community portal. Do check the site, we need senior people as we just have to improve the code before we start promoting the product.


I think this kind of advertisements are not allowed between other threads.

I believe the same.

Otherwise, yes always use:



Be a part of the DaniWeb community

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