Code: Select all
if(isset($_POST['submit'])) {
for($itime=1; $itime<=23; $itime++){
$entry = $_POST[$itime];
if(isset($_POST[$itime])){
$resultplanner= mysql_query("SELECT event FROM plannerentries WHERE userid = '".$user_id."' AND day = '".$day."' AND month = '".$month."' AND time = '".$itime."' AND year = '".$year."'") or die(mysql_error());
$rowplanner = mysql_fetch_array($resultplanner);
$currententry = $rowplanner['event'];
$currententrytest = strlen($currententry);
if($currententrytest == 0) {
$entry = addslashes($_POST['$entry']);
mysql_query("INSERT INTO plannerentries (userid, day, month, year, time, event) VALUES ('".$user_id."', '".$day."', '".$month."' , '".$year."', '".$itime."' '".$entry."')");
echo "You successfully submited your planner entries for the" . $day . "/" . $month . "/" . $year . "<a href=\"edit_planner_check.php\">Click here</a> to add/edit another entry";
}
else
{
$entry = addslashes($_POST['$itime']);
mysql_query("UPDATE plannerentries SET event = '".$entry."' WHERE userid = '".$user_id."' AND day = '".$day."' AND month = '".$month."' AND time = '".$itime."' AND year = '".$year."'");
echo "You successfully updated your planner entries for the" . $day . "/" . $month . "/" . $year . "<a href=\"edit_planner_check.php\">Click here</a> to add/edit another entry";
}
}
}Thanks...