real_escape_string中的一个变量可能有多个连接吗?
我的问题是我需要将相同的$_POST
插入两个不同的数据库中。
请参见此处:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
$con2=mysqli_connect("localhost2","my_user2","my_password2","my_db2");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// escape variables for security
$username = mysqli_real_escape_string($con, $con2, $_POST['username']);
mysqli_close($con, $con2);
?>