As somewhat of a newbie, my biggest struggle sometimes is syntax...Originally, I was able to insert data from this script to the database...now I need it to either insert or update depending on whether the value of the variable $Update is Y or N...I keep getting a parse error and am not sure the syntax of this if else...Please help...<?php
$class_id=trim($class_id);
$date = ($sel_year."/".$sel_month."/".$sel_day);
$description=trim($description);
$date2 = ($sel_month."/".$sel_day."/".$sel_year);
$Host="localhost";
$User="click";
$Password="clickdb21";
$DBName="clickdb";
$TableName="sampledaycare_calendar";
$Link=mysql_connect($Host,$User,$Password);
mysql_select_db("clickdb");
if ($Update = "Y") {
$updatesql="UPDATE $TableName SET description='$description' where class_id='$class_id' and date='$date'";}
if(mysql_db_query($DBName,$updatesql))
{
echo ("You have sucessfully updated $date2\n");
}else
{
echo $updatesql;
echo "The update could not be executed, please contact technical support!".$updatesql;
}else{
$Query="INSERT into $TableName values ('0','$class_id','$date','$description')";}
if (mysql_db_query ($DBName,$Query,$Link)){
print ("You have successfully inputed $date2\n");
}else{
print ("The entry could not be executed, please contact technical support!<br>\n");
}
mysql_close($Link);
?>