How to update 2 columns with single post at the same time?
How to update 2 columns with single post at the same time?
`$username = $_POST['username_reg'];
$password_reg=$_POST['password_reg'];
$password = md5($password_reg);
$user_reg_date = date("Y-m-d", time());
$user_insert= $db->prepare("INSERT INTO users (username,password_tr,password,user_reg_date) VALUES (?,?,?,?)");
$insert = $user_insert->execute(array($username,$password_tr,$password,$user_reg_date));
$err = $user_insert->errorInfo();
if (empty($err[2])) {
echo 1;
} else {
echo "Error!";
}`
How to update 2 columns with single post at the same time?
This discussion has been closed.
Replies
Please help me.
I'm not clear on how this relates to DataTables. It appears to be a generic PHP question?
This is a DataTables forum and you'd be better asking general programming questions on StackOverflow or similar.
Allan
Sorry. I could not tell right. How can I write the above SQL query using the Editor class?
If you are using the
Editor
PHP class you shouldn't need to write your own SQL queries. It will build the queries for you based on the data passed in from the client-side and the fields configured for the instance. The getting started documentation describes how you can use theEditor
PHP class.Allan
Thank you, Allan.
I have read how to use the editor class. I want to ask:
How can we add another sql column to our Field :: inst ('password_reg')
For example (Use of PDO):
`$username = $_POST["username_reg"];
$password_reg=$_POST["password_reg"];
$password = md5($password_reg);// **How do I do this use editor class? Is it so : Field :: inst ('password')=md5( Field :: inst ('password_reg')) **
$user_insert= $db->prepare("INSERT INTO users (username,password_tr,password) VALUES (?,?,?)");
$insert = $user_insert->execute(array($username,$password_reg,$password));
`
Use a set formatter if you want to modify a value that is sent by the client-side.
Allan