![]() |
Sergey Kornilov admin 10/6/2019 |
The most obvious issue us that you are using $user variable in your SQL Query that is not defined anywhere. |
K
|
keithh0427 author 10/7/2019 |
You are right about the $user and $userName. I had changed the userName variable in the code, but forgot to change the post on here. My apologies. |
C
|
Corrie 10/8/2019 |
Change the $db_exec to just db_exec. (Without the $ sign) I am trying to work with some buttons on a list page that is inserted with each record listed. The button is supposed to verify the user's intentions by asking them if they are sure they want to perform the function desired. That works. But, the desired function is not being performed. Here is my code. Client Before: var r = confirm("Are you sure you want to unsubscribe this sacrament?"); if (r == true) { params["unsubscribe"] = "Yes"; } else { params["unsubscribe"] = "No"; } Server: global $conn; $result["unsubscribe"] = $params["unsubscribe"]; IF($params["unsubscribe"] == "Yes") { $userName = Security::getUserName(); $today = date('Y-m-d'); $record = $button->getCurrentRecord(); $sql = "UPDATE recruit SET unsubscribed = 'Y', unsubscribedDate = now(), unsubscribedBy = '" . $user . "', WHERE recruitID = '" . $record["recruitID"] . "'"; $db_exec($sql, $conn); } The Client Before is working. The Server is not. I've checked the $sql by plugging in the correct values and it does work. I've got something wrong somewhere, but can't seem to figure it out. |