insert date posted from html form in mysql?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
devmatch
Forum Newbie
Posts: 19
Joined: Thu Mar 27, 2003 3:58 am

insert date posted from html form in mysql?

Post 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
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Post 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
devmatch
Forum Newbie
Posts: 19
Joined: Thu Mar 27, 2003 3:58 am

NO 3

Post 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;)
Post Reply