473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Trouble saving datetime picker value into database

Hi, I'm using php 5.2.3 with mysql server 5.1 as backend.
I have a program in which a person enters or chooses two dates from two datetime pickers and other info, I'm not sure if the problem is in the Datatype for the datetime picker declared in the table editor why none of the fields save in the database. I entered the datatype as DATE. and my datetime pickers code look like this:
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript" src="datetimepicker.js">
  2.  
  3. //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
  4. //Script featured on JavaScript Kit (http://www.javascriptkit.com)
  5. //For this script, visit http://www.javascriptkit.com 
  6.  
  7. </script>
  8.  
  9. //DATES-called from scripts
  10. //Function CreateInputField($field_title,$input_type,$input_name,$input_value,$input_size,$td_width)                                    
  11. $f1->createInputField("<b>$lang->reservDate:</b>",'text','reserv_date',"$redate_value",'40','150');
  12. $f1->createInputField("<b>$lang->departDate:</b>",'text','reserv_date2',"$redate2_value",'40','150');
  13.  
  14. echo "Select Arrival Date: <a href=\"javascript:NewCal('reserv_date','ddmmyyyy')\"><img src=\"../images/cal.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Pick a date\"></a>                             ";
  15. echo "            Select Departure Date: <a href=\"javascript:NewCal('reserv_date2','ddmmyyyy')\"><img src=\"../images/cal.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Pick a date\"></a>";
Any help will be greatly appreciated...thanks mites
Mar 25 '08 #1
4 4924
chaarmann
785 Expert 512MB
Hi, I'm using php 5.2.3 with mysql server 5.1 as backend.
I have a program in which a person enters or chooses two dates from two datetime pickers and other info, I'm not sure if the problem is in the Datatype for the datetime picker declared in the table editor why none of the fields save in the database. I entered the datatype as DATE. and my datetime pickers code look like this:
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript" src="datetimepicker.js">
  2.  
  3. //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
  4. //Script featured on JavaScript Kit (http://www.javascriptkit.com)
  5. //For this script, visit http://www.javascriptkit.com 
  6.  
  7. </script>
  8.  
  9. //DATES-called from scripts
  10. //Function CreateInputField($field_title,$input_type,$input_name,$input_value,$input_size,$td_width)                                    
  11. $f1->createInputField("<b>$lang->reservDate:</b>",'text','reserv_date',"$redate_value",'40','150');
  12. $f1->createInputField("<b>$lang->departDate:</b>",'text','reserv_date2',"$redate2_value",'40','150');
  13.  
  14. echo "Select Arrival Date: <a href=\"javascript:NewCal('reserv_date','ddmmyyyy')\"><img src=\"../images/cal.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Pick a date\"></a>                             ";
  15. echo "            Select Departure Date: <a href=\"javascript:NewCal('reserv_date2','ddmmyyyy')\"><img src=\"../images/cal.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Pick a date\"></a>";
Any help will be greatly appreciated...thanks mites
What says TengYong Ng to the fact that his code doesn't run for you? You should write your own code (read posting guidelines).

Anyway,you copied the wrong code. This code runs on the client browser, but it does not run on the server. You have not even a single PHP command in "your" code and not even a single SQL-command to save the entered value into the database.
Mar 26 '08 #2
What says TengYong Ng to the fact that his code doesn't run for you? You should write your own code (read posting guidelines).

Anyway,you copied the wrong code. This code runs on the client browser, but it does not run on the server. You have not even a single PHP command in "your" code and not even a single SQL-command to save the entered value into the database.
Yeah thanks, Basically I would like to know whether DATE is a proper Datatype for a datetimepicker?

---GM
Mar 26 '08 #3
chaarmann
785 Expert 512MB
Yeah thanks, Basically I would like to know whether DATE is a proper Datatype for a datetimepicker?

---GM
That's the type of question with which you make friends here.

You should use TIMESTAMP or DATETIME for storing the date and time. DATE only can store the date, but not the time. This is different from oracle-db where DATE also can store the time.
Use TIMESTAMP if you need high resolution up to the milliseconds and if all dates are after 1970. Else use DATETIME
Mar 26 '08 #4
That's the type of question with which you make friends here.

You should use TIMESTAMP or DATETIME for storing the date and time. DATE only can store the date, but not the time. This is different from oracle-db where DATE also can store the time.
Use TIMESTAMP if you need high resolution up to the milliseconds and if all dates are after 1970. Else use DATETIME
Thanks chaarmann...I appreciate ur help
Mar 26 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an...
0
by: Ata İsmet Özçelik | last post by:
Hi there, I have a problem with the DateTime picker.. I want to use my custom format; for this I can give a string for the format.But My goal is to have the month name in the box in upper case...
1
by: Dean L. Howen | last post by:
Dear friends, Could you help me to solve the problem: How can we set/get NULL values of datetime in DatetimePicker ? I design a form using DateTimePicker to input/output date value, but the date...
0
by: Qumer Mumtaz Goraya | last post by:
Hi There is a datatime picker control in one column of my datagrid.When the cell of sepecific column get the focus the datetime picker control appeare It shows the current system date.If once I...
3
by: Brian | last post by:
Hello, I have a wierd problem. I have a datetime picker that doesn't seem to want to sinc up its .value and .text proberties. I can step through the code and see that they are different values. ...
5
by: Michel Posseth [MCP] | last post by:
Hello we have encountered the following problems with the date time picker control A : datetime picker control gives focus to last entered field when moving back and forward with focus how do...
1
mafaisal
by: mafaisal | last post by:
Hello Experts I am Using vb.net 2005 Hw To Put DateTime Picker in Datagrid view I have to sea Datetime Picker in Specified Cilomn of Datagrid I try This But The Location Hw To Change to the...
1
by: sonubaba | last post by:
hello, my question is, in my web application i need datetime picker control in which user can select both date and time from DateTime Picker control i could not find this anywhere on inter net ...
0
by: =?Utf-8?B?a3BpenpsZQ==?= | last post by:
Hi all. using vs.net 9, C# I've got a trivial dilemma right now with my datetimepicker. It is bound to a datetime field in a database. This field is also set to not allow nulls. The default...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.