0

$grade=$_POST["grade"];
$stream=$_POST["stream"];
$a=='A';

$query="delete * from class where grade_id='$grade' and stream='$stream' and class_name='$a'";
$result=mysql_query($query);
if($stream==null)(
$query1="insert into class values(null,'$a','$grade','null')";
$result=mysql_query($query1);
}else(
$query1="insert into class values(null,'$a','$grade','$stream')";
$result=mysql_query($query1);
)

in this code runs .the code which color in red is occur error . please someone can tell me the reason for that?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by sameeya007
0

on the last value you are inserting you have: 'null' Get rid of those apostrophes. It should be just NULL. Also, I suggest you list the fields you are inserting the data into: $query1="INSERT INTO `class`(`field1`,`field2`,`field3`,`field4`) VALUES(NULL,'$a','$grade', NULL)"; Replace the field# with the actual names of the fields in your db table.

Edited by hielo: n/a

0

if($stream==null)(
$query1="insert into class values(null,'$a','$grade','null')";
$result=mysql_query($query1);
}else(
$query1="insert into class values(null,'$a','$grade','$stream')";
$result=mysql_query($query1);
)
in this code "if" condition check that the $stream==null

what happen is when that $ stream null ,in that class table last field is $stream .I wanted to fill last column in string null in the class table.so what i want to do

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.