- Tue Jan 09, 2018 2:44 pm
#812757
I'm trying to insert data into an external database from a dynaform but I can not. Please, you can give me the trigger code that does that.
$db = '1234567890abcde1234567890abcde'; //set to the UID of the database connection;
//check if one variable is set, to make sure that the dynaform was submitted:
if (isset(@@firstName)) {
//use mysql_real_escape_string(), mysqli_real_escape_string() or addslashes() as a last resort
//to escape strings to prevent SQL injection attacks:
$firstName = mysql_real_escape_string(@@firstName);
$lastName = mysql_real_escape_string(@@lastName);
//Datetimes are in "YYYY-MM-DD HH:MM:SS" format which works to insert in MySQL, PostgreSQL
//and MS SQL Server, but needs to be formatted with the TO_DATE() function in Oracle.
//access datetime variables as strings.
//Set as NULL if empty or a string enclosed in single quotation marks.
$startDate = empty(@@contractStartDate) ? NULL : "'". @@contractStartDate . "'";
$salary = @#salary; //access as a floating-point number
$age = @%age; //access as an integer
//make sure to include strings and dates inside single quotation marks, but numbers don't need them.
$sql = "INSERT INTO CLIENTS (FIRST_NAME, LAST_NAME, CONTRACT_START_DATE, SALARY, AGE)
VALUES ('$firstName', '$lastName', $startDate, $salary, $age)";
executeQuery($sql, $db);
}
The market for cryptocurrencies is demonstrating a[…]
Hello. For rental housing, there are software solu[…]