J
|
Jane 1/20/2011 |
Hi, global $strTableName;
|
J
|
jianwong author 1/20/2011 |
Hi, use Add page: Before process event on the Eventstab to calculate this value and save it in the session variable. Here is a sample: global $strTableName;
|
V
|
Vienna 1/20/2011 |
Hi Jane I follow the sample event code, unfortunately it produced error as in below. Please advise where wrong. =============================== Error description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 URL: jianwong.com/csauto/JobDetail_add.php? Error file: /home/jianwong/public_html/csauto/include/dbconnection.php Error line: 36 SQL query: select max(IDField) as m from TableName where DetailKey= ===============================
|
J
|
jianwong author 1/20/2011 |
From what I can tell where it says "TableName" inside the Custom Query you went ahead and used it exactly like that without replacing "TableName" with the exact name of YOUR SPECIFIC project table where you want that detailkey to match up. It is inside that query string "select max(IDField) as m from theTableNameyouwant where DetailKey="from my own project I would have written that as "..from doctor_address where DetailKey....
|
![]() |
romaldus 1/20/2011 |
Hi Vienna Thank you for sharing. My table name is JobDetail, I changed the code as in below, however, it still produced the same error. Must I change the "(IDField)" also? Please advise. ==================== global $strTableName; $rstmp = CustomQuery("select max(IDField) as m from JobDetail where DetailKey=".$_SESSION[$strTableName."_masterkey1"]);$datatmp = db_fetch_array($rstmp); $_SESSION["Nextnumber"] = $datatmp["m"]+1; ====================
|
J
|
jianwong author 1/21/2011 |
Note: this script cannot used in AUTONCREMENT field in database. For example, if IDField in JobDetail table is a Primary key and autoincrement by database engine.
|