Prawn, please help me optimize this SQL statement
Prawn, please help me optimize this SQL statement
$sql = "UPDATE". $table. " ' SET $field = concat (' ". $value [' result ']." {HX} ', now (), ' {HX} '. $value [' name ']. " {HX} '. $value [' op ']. " {HX} '. $value [' suggestion ']. "') $auditing WHERE ' id ' = '. $value [' id '];
Global $conn;
mysql_query ($sql, $conn);
if ($auditing = = ", ' check ' = ' yes ') {
$sql = "Select ' mu_id ' from ' $table ' WHERE ' id ' = $value [id] LIMIT 1";
$sql = mysql_query ($sql, $conn);
$mu _id = mysql_fetch_array ($sql);
$sql = "UPDATE ' member_user ' SET ' check ' = ' yes ', ' UpdateTime ' =now () WHERE ' id ' = $mu _id[0]";
mysql_query ($sql, $conn);
}
Unset ($conn);
Return "approval success";
SQL Optimized MySQL PHP
Share to:
------Solution--------------------
Put Concat (' ". $value [' result ']." {HX} ', now (), ' {HX} '. $value [' name ']. " {HX} '. $value [' op ']. " {HX} '. $value [' suggestion ']. "') This is implemented in PHP, not with SQL Concat.
There is the database index, which is very helpful to improve the speed