Implementing ROW CONSTRUCTOR USING MYSQL IN PHP

Below is the ROW CONSTRUCTOR using mysql in PHP implementation.

This way you can combine multiple insert queries into single query for insert operation in mysql which will increase the application performance.

$sql = array();


$sql[] = "(".$empid.",'".mysql_real_escape_string($_POST["name"])."', '".date2yyyymmdd(mysql_real_escape_string( trim($_POST["dob"])))."','".$_POST["age"]."',1)";


$this->Query('INSERT INTO table (emp_id, name, dob, age,status) VALUES '.implode(',', $sql));

No comments:

Post a Comment