This topic is locked
[SOLVED]

 Uploading 'time' data to MySQL

8/15/2005 10:42:02 AM
PHPRunner General questions
J
Jack author

I week ago I posted a question concerning sending time data to MySQL. Thank you for your promp response. I failed to specify however, that my requirement is for time data alone, without the date. This functionality is critical for my application. Is there a modification I can make to the output code pages that will enable this?
Thanks again,

Jack

admin 8/16/2005

Hi,
I see what you saying.
You need to choose TIME data type for your time field in MySQL.

Proceed to the Formattingtab in PHPRunner. Don't set any View as format for your time field and set Edit as- Text field format.
Open \include\dbconnection.php file by any text editor and replace this line

if($type=="DATE" || $type=="DATETIME" || $type=="TIME" || $type=="TIMESTAMP")


with this one:

if($type=="DATE" || $type=="DATETIME" || $type=="TIMESTAMP")

J
Jack author 8/17/2005

Thank you Sergey,
That's a big help. Although the DateTime format is best for my application, having to type the date and time was undesireable. Using separate fields for Date / Time allows me to take advantage of the date picker, and only have to type the time. Going back to a single DateTime format field would be best if I could incorporate a datetime picker.
Question: I have in hand a javascript datetime picker (http://www.javascriptkit.com/script/script2/tengcalendar.shtml) that I am trying to 'sledgehammer' into my application. I have added datetimepicker.js' to the include folder and replaced 'ts_picker.js' with 'datetimepicker.js' in the _Add and _Edit pages. I replaced the 'show_calendar' function call with the requisite 'NewCal' of the datetimepicker. The 'NewCal' function requires as one of its parameters the 'textboxID'. What do I specify for the textboxID?
Thank you so much,
Jack

admin 8/17/2005

Jack,
this task is more complex than simply specify correct fieldname.

Here is how you can attach this datepicker to PHPRunner pages.

This procedure is tested and proven to work.
1. Go to Formatting tab in PHPRunner and select edit format for your date field - Simple edit box.
2. Build the pages.
3. Copy datepicjker.js to include folder.
4. If you use English(U.S.) regional settings, then edit datetimepicker.js . Replace

var DateSeparator="-";



with

var DateSeparator="/";


5. Open include/..._function.php and find the following construct in the beginning

$fieldlist = array();

$fieldlist[]="id";

$fieldlist[]="name";

...



where id, name are your field names. Locate your datetime field, count its index and keep it in mind. Indexes start from 0. I.e. id has index 0, name - 1, etc.

Let's datetime field index be 9.
6. Open ..._edit.php file. Replace

<script language="JavaScript" src="include/ts_picker.js"></script>



with

<script language="JavaScript" src="include/datetimepicker.js"></script>



Then locate

echo BuildEditControl("datefield",$value,GetEditFormat("datefield"),MODE_EDIT);

where datefield is your datetime field. And insert the following snippet just after:

?>

<a href="javascript:NewCal('value9','mmddyyyy',1)"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>

<?php


7. Do the same with ..._add.php file