Page 1 of 1

insert date posted from html form in mysql?

Posted: Mon May 26, 2003 11:31 am
by devmatch
hello,
i've got following code:
$couponInfo["coupon_validity_start_date"] = "'".$start_date_year."-".$start_date_month."-".$start_date_day."3'";

posted from form ...action="<?echo basename($PHP_SELF);?>"... method="POST"
<select name="start_date_month">
<option value="1" selected>01</option>
...
same for date and year
seems ok for me
:oops:
but here is the mysql error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '2003-1-3'', '')' at line 1
???
anyone out there helping me???
THX

Posted: Mon May 26, 2003 12:31 pm
by Jade
Try this:

$couponInfo["coupon_validity_start_date"] = $start_date_year . "-" . $start_date_month . "-" . $start_date_day . "3";

Not sure if it'll work but its worth a try.
Jade

NO 3

Posted: Mon May 26, 2003 12:57 pm
by devmatch
sorry... $couponInfo["coupon_validity_start_date"] = "'".$start_date_year."-".$start_date_month."-".$start_date_day."'"!!! i've tried to find the error durrind insertion the 3;)
THX i'll try it and answer if it works...
HEUREKA!!!
seems to be working good... THX
sometimes you can make problems were no problems should be;)