Hi,
I have to add the delivery day, month & year which is one form.. to be inserted in the database ..
in my form file the day, month, year are in this way:
<select name="day">
<option value=http://www.phpbuilder.com/board/archive/index.php/"">--
<?
for($d=01;$d<32;$d++)
{
?>
<option value="<? echo $d ?>"><? echo $d ?>
<?
}
?>
</select>
Month <select name="month">
<option value="">--
<?
for($m=01;$m<13;$m++)
{
?>
<option value="<? echo $m ?>"><? echo $m ?>
<?
}
?>
</select>
Year <select name="year">
<option value="">----
<?
for($y=2001;$y<2011;$y++)
{
?>
<option value="<? echo $y ?>"><? echo $y ?>
<?
}
?>
</select>
and in my php file I have typed the query in this way:
$selected_date = $year."-".$month."-".$day;
// taken the year, month and day in a string
echo "The selected date is :".$selected_date."<br>";
$insert_date_query = "INSERT INTO $content_table (date_delivery) VALUES ('$selected_date')";
MYSQL_QUERY($insert_date_query);
..
if I try to insert the script through PHP it gives me this error..:
The selected date is :2009-10-14
You have an error in your SQL syntax near '(date_delivery) VALUES ('2009-10-14')' at line 1
Can anyone tell me where I am worng..
Naveen
I have to add the delivery day, month & year which is one form.. to be inserted in the database ..
in my form file the day, month, year are in this way:
<select name="day">
<option value=http://www.phpbuilder.com/board/archive/index.php/"">--
<?
for($d=01;$d<32;$d++)
{
?>
<option value="<? echo $d ?>"><? echo $d ?>
<?
}
?>
</select>
Month <select name="month">
<option value="">--
<?
for($m=01;$m<13;$m++)
{
?>
<option value="<? echo $m ?>"><? echo $m ?>
<?
}
?>
</select>
Year <select name="year">
<option value="">----
<?
for($y=2001;$y<2011;$y++)
{
?>
<option value="<? echo $y ?>"><? echo $y ?>
<?
}
?>
</select>
and in my php file I have typed the query in this way:
$selected_date = $year."-".$month."-".$day;
// taken the year, month and day in a string
echo "The selected date is :".$selected_date."<br>";
$insert_date_query = "INSERT INTO $content_table (date_delivery) VALUES ('$selected_date')";
MYSQL_QUERY($insert_date_query);
..
if I try to insert the script through PHP it gives me this error..:
The selected date is :2009-10-14
You have an error in your SQL syntax near '(date_delivery) VALUES ('2009-10-14')' at line 1
Can anyone tell me where I am worng..
Naveen