Im new to programming and i cant understand why this code is not working.
<?php
$host="localhost";
$username="ryan";
$password="s@ch!911";
$db_name="webservice";
$con=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$ngno = '112';
$myArray = array("date"=> "Mon Apr 11 00:00:00 GMT+05:30 2016", "Thu Mar 31 00:00:00 GMT+05:30 2016");
foreach($myArray as $dateSelected => $dateValue){
$sql = "INSERT INTO datepicker(ngno, date) VALUES($ngno, $dateValue)";
$result = mysql_query($sql);
}
?>
datepicker table has 3 columns. which are entry_id, ngno, date. entry_id gets auto incremented. I have tried removing the entry_id column as well. But no luck. I have other php files using the same Database and they are all working fine. Inserting, Selecting etc works fine. But when i run this php nothing happens.what am i doing wrong here?