
popularanky
Posts: 53
|
| Posted: 08/04/2010, 12:53 AM |
|
I am looking for a serious help. I have looked round CCS and can find the solution.
I have about three forms on a page with different Database table (Educational profile, work profile). I want to use ONE Add button to add the forms into their tables in the database.
I will be glad if this solve
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive |
 |
 |
datadoit
|
| Posted: 08/04/2010, 5:06 AM |
|
To update other tables from your form, use Custom Code in
AfterExecuteInsert/Update events.
See: http://docs.codecharge.com/studio40/html/ProgrammingTec...tomSQL.html?toc
|
|
|
 |
popularanky
Posts: 53
|
| Posted: 08/05/2010, 2:38 AM |
|
Thanks for the quick reply. I problem here is that I am a newbies. I am two tables TABLE A consist of DocID, DocDate, Desc and CabinetID while TABLE B consist of EditID, EditDate, Desc, CabinetID, I am creating a form for TABLE B and I want TABLE A to update its records whenever a new record in inserted into TABLE B. How can I achieve this with the below php code:
} function Tasks_DataSource_AfterExecuteUpdate(& $sender) { $db = new clsDBConnection1(); $SQL = "INSERT INTO report (report_task_id,report_creator) ". "VALUES (". $db->ToSQL(CCGetFromGet("task_id",0),ccsInteger) .",". $db->ToSQL(CCGetUserID(),ccsInteger) .")"; $db->query($SQL); $db->close();
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive |
 |
 |
datadoit
|
| Posted: 08/05/2010, 6:32 AM |
|
What is the relationship between the two tables? Is this relationship
one-to-one or one-to-many?
|
|
|
 |
popularanky
Posts: 53
|
| Posted: 08/05/2010, 7:25 AM |
|
No Relationship between the tables. I will create a one to one Relationship now in TABLE B (DocID)
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive |
 |
 |
datadoit
|
| Posted: 08/05/2010, 8:02 AM |
|
Are you wanting to track whenever each and every edit is made on a
document (such as datetime and by whom), or just track when the "last"
edit was made on a document and by whom?
|
|
|
 |
popularanky
Posts: 53
|
| Posted: 08/05/2010, 8:27 AM |
|
I want to track Whenever each and every edit is made from date, word edit and by whom.
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive |
 |
 |
datadoit
|
| Posted: 08/05/2010, 11:12 AM |
|
Try something like:
log_docs:
LogID (INT, AUTOINCREMENT)
DocID (INT)
DocDate (DATETIME)
DocUserID (INT)
DocIP (CHAR, 15)
Then in the record form's AfterExecuteInsert event:
global $DBYourConnectionName;
$LastInsKey = mysql_insert_id();
$IP = $_SERVER['REMOTE_ADDR'];
$db = new clsDBYourConnectionName();
$db->query("INSERT INTO log_docs SET "
. "DocID=" . CCToSQL($LastInsKey, ccsInteger)
. ", DocDate=NOW()"
. ", DocUserID=" . CCToSQL(CCGetUserID(), ccsInteger)
. ", DocIP=" . CCToSQL($IP, ccsText) );
$db->close();
In the record form's AfterExecuteUpdate event:
global $DBYourConnectionName;
$IP = $_SERVER['REMOTE_ADDR'];
if (CCGetParam("DocID","")>0) {
$db = new clsDBYourConnectionName();
$db->query("INSERT INTO log_docs SET "
. "DocID=" . CCToSQL(CCGetParam("DocID",""), ccsInteger)
. ", DocDate=NOW()"
. ", DocUserID=" . CCToSQL(CCGetUserID(), ccsInteger)
. ", DocIP=" . CCToSQL($IP, ccsText) );
$db->close();
}
If you want to track when deletes are made, then put the same code above
into the form's AfterExecuteDelete event.
|
|
|
 |
|

|
|
|
|