bcschnei
|
| Posted: 05/09/2003, 2:02 PM |
|
I am having a issue with updateding records with PHP.
I have a editable grid with three data colums groupid, updatedby, and updateddate. With a hidden field for the seq_num, which is the primary key.
I then have two columns with check boxes for Close_Group and Delete_Group.
The Closed_Group check box is tied to the status field in the table. I created a custom update to set the updateby to CCGetUserID() and the updateddate to time().
The plan is to update the records that are checked when the Submit button is clicked. However whenever I check the Closed_Group box on a record and submit, it updates all of the records in the grid with the current user and date. I only want it to update the record I selected and not any of the others.
Here is the Update_Method that CCS generated.
//Update Method @53-B00723EE
function Update()
{
$groupid = new clsSQLParameter("dsgroupid", ccsText, "", "", $this->CachedColumns["groupid"], "", false, $this->ErrorBlock);
$updatedby = new clsSQLParameter("expr73", ccsText, "", "", CCGetUserID(), "", false, $this->ErrorBlock);
$updateddate = new clsSQLParameter("expr74", ccsDate, Array("mm", "/", "dd", "/", "yyyy"), Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"), time(), "", false, $this->ErrorBlock);
$status = new clsSQLParameter("ctrlstatus", ccsText, "", "", $this->status->GetValue(), "", false, $this->ErrorBlock);
$wp = new clsSQLParameters($this->ErrorBlock);
$wp->AddParameter("1", "dsseq_num", ccsInteger, "", "", $this->CachedColumns["seq_num"], "", false);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$wp->Criterion[1] = $wp->Operation(opEqual, "seq_num", $wp->GetDBValue("1"), $this->ToSQL($wp->GetDBValue("1"), ccsInteger),false);
$Where = $wp->Criterion[1];
$this->SQL = "UPDATE client_groups SET "
. "groupid=" . $this->ToSQL($groupid->GetDBValue(), $groupid->DataType) . ", "
. "updatedby=" . $this->ToSQL($updatedby->GetDBValue(), $updatedby->DataType) . ", "
. "updateddate=" . $this->ToSQL($updateddate->GetDBValue(), $updateddate->DataType) . ", "
. "status=" . $this->ToSQL($status->GetDBValue(), $status->DataType);
$this->SQL = CCBuildSQL($this->SQL, $Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate");
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
$this->close();
}
//End Update Method
Any help is greatly appricated.
Thanks,
Ben
|
|
|
 |
mark s
|
| Posted: 05/12/2003, 12:16 PM |
|
I was just searching for a solution to exactly the same problem, though I'm using VB, if you resolve this can you let me know also.heywood90@hotmail.com
|
|
|
 |
|