CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Time Field Problem

Print topic Send  topic

Author Message
RogerR

Posts: 21
Posted: 02/12/2004, 8:48 AM

Not having used a time field in CCS before I don't know if this is a bug that has just shown up or if I've some how managed to screw something up. Since, as I said, I've not used a time field before I'm more inclined to think it is something that I've done; any way here is my problem:

[The database is MySQL and the code is of course PHP]

Problem: The Time Field is empty, as you can see from the source code generated from the loaded page. [see below]
  
<tr>  
    <td class="BlueNoteDataTD"><a class="BlueNoteDataLink" href="timesheet_maint.php?timesheetOrder=Sorter_logTime×heetDir=ASC&id=1">Record</a> </td>   
    <td class="BlueNoteDataTD">1 </td>   
    <td class="BlueNoteDataTD">Ester, Polly </td>   
    <td class="BlueNoteDataTD">Administrative </td>   
    <td class="BlueNoteDataTD">Reception Services </td>   
    <td class="BlueNoteDataTD">02/11/2004 </td>   
    <td class="BlueNoteDataTD"> </td> +++[Time should be displayed here]+++  
    <td class="BlueNoteDataTD">IN </td>   
  </tr>  
  

The time is found in the database table but is not loading with the rest of the data when populating a page.

I apologize for the length of this post but I hope I'm providing everything necessary to get some help with this problem. Below is the code from the PHP page that I think is relavent to my problem without posting the whole page:

--------------------------------------[Code Segments Start Here]------------------------------------------------
  
    function Open()  
    {  
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");  
        $this->CountSQL = "SELECT COUNT(*)  " .  
        "FROM ((timesheet LEFT JOIN employees ON " .  
        "timesheet.emp_id = employees.emp_id) LEFT JOIN divisions ON " .  
        "timesheet.division_id = divisions.DivID) LEFT JOIN units ON " .  
        "timesheet.unit_id = units.unitID";  
        $this->SQL = "SELECT id, timesheet.emp_id AS timesheet_emp_id, timesheet.unit_id AS timesheet_unit_id, timesheet.division_id AS timesheet_division_id, " .  
        "logDate, logTime, `Action`, employees.emp_id AS employees_emp_id, emp_name AS employees_emp_name, DivisionName, UnitName  " .  
        "FROM ((timesheet LEFT JOIN employees ON " .  
        "timesheet.emp_id = employees.emp_id) LEFT JOIN divisions ON " .  
        "timesheet.division_id = divisions.DivID) LEFT JOIN units ON " .  
        "timesheet.unit_id = units.unitID";  
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");  
        $this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);  
        $this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order));  
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");  
        $this->MoveToPage($this->AbsolutePage);  
    }  
      
-----------------------------------------------------------------------------------------------------  
  
    function SetValues()  
    {  
        $this->id->SetDBValue(trim($this->f("id")));  
        $this->emp_name->SetDBValue($this->f("employees_emp_name"));  
        $this->DivisionName->SetDBValue($this->f("DivisionName"));  
        $this->UnitName->SetDBValue($this->f("UnitName"));  
        $this->logDate->SetDBValue(trim($this->f("logDate")));  
        $this->logTime->SetDBValue(trim($this->f("logTime")));  
        $this->Action->SetDBValue($this->f("Action"));  
    }  
  
-----------------------------------------------------------------------------------------------------  
  
    function Show()  
    {  
        global $Tpl;  
        if(!$this->Visible) return;  
  
        $ShownRecords = 0;  
  
        $this->ds->Parameters["urls_emp_id"] = CCGetFromGet("s_emp_id", "");  
        $this->ds->Parameters["urls_division_id"] = CCGetFromGet("s_division_id", "");  
        $this->ds->Parameters["urls_unit_id"] = CCGetFromGet("s_unit_id", "");  
  
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");  
  
  
        $this->ds->Prepare();  
        $this->ds->Open();  
  
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");  
        if(!$this->Visible) return;  
  
        $GridBlock = "Grid " . $this->ComponentName;  
        $ParentPath = $Tpl->block_path;  
        $Tpl->block_path = $ParentPath . "/" . $GridBlock;  
  
  
        $is_next_record = $this->ds->next_record();  
        if($is_next_record && $ShownRecords < $this->PageSize)  
        {  
            do {  
                    $this->ds->SetValues();  
                $Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";  
                $this->Detail->Parameters = CCGetQueryString("QueryString", Array("ccsForm"));  
                $this->Detail->Parameters = CCAddParam($this->Detail->Parameters, "id", $this->ds->f("id"));  
                $this->Detail->Page = "timesheet_maint.php";  
                $this->id->SetValue($this->ds->id->GetValue());  
                $this->emp_name->SetValue($this->ds->emp_name->GetValue());  
                $this->DivisionName->SetValue($this->ds->DivisionName->GetValue());  
                $this->UnitName->SetValue($this->ds->UnitName->GetValue());  
                $this->logDate->SetValue($this->ds->logDate->GetValue());  
                $this->logTime->SetValue($this->ds->logTime->GetValue());  
                $this->Action->SetValue($this->ds->Action->GetValue());  
                $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");  
                $this->Detail->Show();  
                $this->id->Show();  
                $this->emp_name->Show();  
                $this->DivisionName->Show();  
                $this->UnitName->Show();  
                $this->logDate->Show();  
                $this->logTime->Show();  
                $this->Action->Show();  
                $Tpl->block_path = $ParentPath . "/" . $GridBlock;  
                $Tpl->parse("Row", true);  
                $ShownRecords++;  
                $is_next_record = $this->ds->next_record();  
            } while ($is_next_record && $ShownRecords < $this->PageSize);  
        }  
        else // Show NoRecords block if no records are found  
        {  
            $Tpl->parse("NoRecords", false);  
        }  
  
        $errors = $this->GetErrors();  
        if(strlen($errors))  
        {  
            $Tpl->replaceblock("", $errors);  
            $Tpl->block_path = $ParentPath;  
            return;  
        }  
        $this->Navigator->PageNumber = $this->ds->AbsolutePage;  
        $this->Navigator->TotalPages = $this->ds->PageCount();  
        $this->Sorter_id->Show();  
        $this->Sorter_emp_name->Show();  
        $this->Sorter_DivisionName->Show();  
        $this->Sorter_UnitName->Show();  
        $this->Sorter_logDate->Show();  
        $this->Sorter_logTime->Show();  
        $this->Sorter_Action->Show();  
        $this->timesheet_Insert->Show();  
        $this->Navigator->Show();  
        $Tpl->parse();  
        $Tpl->block_path = $ParentPath;  
        $this->ds->close();  
    }  
 

--------------------------------------[Code Segments End Here]------------------------------------------------

From everything I can see there is no obvious reason for the logTime not to show but yet it does not. Oh as an aside I found that the logTime doesn't showup in the edit screen either.

Any help in solving this mystery will be greatly appreciated.

RogerR
_________________
***********************************************************
The best antivirus a windose user can get - LINUX!
***********************************************************
View profile  Send private message
RogerR

Posts: 21
Posted: 02/12/2004, 9:32 AM

Problem solved!

As I suspected it was something I did. So here is a lesson for anyone else that might run into this particular problem:

I had formatted the logTime field in MySQL as a "time" field and had formatted it in CCS as a "date" field (since there is no time field in CCS). I changed the MySQL field to a "datetime'" field and now all seems to be working fine.

Hope my screwup proves helpful to someone else out there. I would hate to think that I was that stupid for no good reason.

Roger R.
_________________
***********************************************************
The best antivirus a windose user can get - LINUX!
***********************************************************
View profile  Send private message
Don Safar
Posted: 02/12/2004, 12:00 PM

Your not the only person that has struggled with datetime fields. I am
currently trying to implement an event tracker that requires start
date/start time and end date/end time fields. I've managed to split the date
and time fields out so they display on the form properly (I am using a text
field for the date and 3 listboxes -hours, minutes,ampm - the textbox is
tied to the database control). The problem for me is how to re-assemble the
date and time in the beforeupdate event into the date textbox field so the
proper insertion is made into mysql. I am currently working with CCS support
and when an answer is provided by myself or support, I will post here. If
someone else has already figured this out, please post. Thanks!

"RogerR" <RogerR@forum.codecharge> wrote in message
news:5402bb8a12b65a@news.codecharge.com...
> Problem solved!
>
> As I suspected it was something I did. So here is a lesson for anyone
else that might run into this particular problem:
>
> I had formatted the logTime field in MySQL as a "time" field and had
formatted it in CCS as a "date" field (since there is no time field in CCS).
I changed the MySQL field to a "datetime'" field and now all seems to be
working fine.
>
> Hope my screwup proves helpful to someone else out there. I would hate to
think that I was that stupid for no good reason.
>
> Roger R.
> _________________
> ***********************************************************
> The best antivirus a windose user can get - LINUX!
> ***********************************************************
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.