<?php
include("connection.php");
$name=mysql_real_escape_string($_POST['name']);
$wish=mysql_real_escape_string($_POST['wish']);
$date=date("Y-m-d");
$sql=mysql_query("SELECT * from wish WHERE date='$date'");
$res=mysql_fetch_array($sql);
//if($res['date'] $date){
//$query=mysql_query("UPDATE `wish` SET `name`='$name',`wish`='$wish', `date`='$date' WHERE date!='$date'")or die(mysql_error());
//}
/*else{ */
$query=mysql_query("INSERT INTO wish VALUES(' ','$name','$wish','$date')") or die(mysql_error());
//}
if($query){
?>
<script>
alert('Successfull......!!!');
window.location.href="view_wish.php";
</script>
<?php }
else
{ ?>
<script>
alert('There is Some error While uploading');
window.location.href="add_wish.php";
</script>
<?php } ?>