|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need help, I am trying to pass a date value like "1999-08-21" into mySQL database, it is not saving to the database.
Here is the code <? if( isset($category) && isset($product) && isset($saleprice) && isset($entrydate)){ mysql_connect)"localhost", "webuser", ""); $query = "INSERT INTO items VALUES('$category', '$product', '$saleprice', '$entrydate', NULL)"; $result = mysql_db_query("onsale", $query); if ($result) { echo "added"; } } ?> where onsale is the mySQL database, items is a table, and saleprice is decimal(6,2) and entrydate is date and last column is ID a primary key with auto_increment and an no null value. |
|
#2
|
|||
|
|||
|
It's not adding anything or just the date? How to proceed depends on that. A couple things to check.
Print the values you are trying to add to make sure they have what you think they have. check mysql_error() "describe" the table from the command line to make sure the columns are set to the types you think they are. From your code and what you describe this should work. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > how do I pass date values to a mySQL database using PHP3 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|