大家好,所以我有这个代码但是当我运行它时,新数据库是空的我真的不知道为什么没有错误日志,这是我的代码:
<?php
$db_host="localhost";
$db_nombre="****";
$db_nombre2="*****";
$db_usuario="****";
$db_password="*****";
ini_set('memory_limit','500M');
$conexion=mysqli_connect($db_host,$db_usuario,$db_password,$db_nombre);
$conexion2=mysqli_connect($db_host,$db_usuario,$db_password,$db_nombre2);
$data = mysqli_query($conexion,"SELECT v.id, v.userid,v.dueDate, v.status, c.firstname, c.lastname, c.phonenumber FROM tblinvoices v, tblclients c WHERE v.dueDate > '2017-12-10'");
$values = Array();
while ($row = mysqli_fetch_assoc($data)) {
$row[id] = mysqli_real_escape_string($conexion,$row['id']);
$row[userid] = mysqli_real_escape_string($conexion,$row['userid']);
$row[duedate] = mysqli_real_escape_string($conexion,$row['duedate']);
$row[status] = mysqli_real_escape_string($conexion,$row['status']);
$row[firstname] = mysqli_real_escape_string($conexion,$row['lastname']);
$row[lastname] = mysqli_real_escape_string($conexion,$row['lastname']);
$row[phonenumber] = mysqli_real_escape_string($conexion,$row['phonenumber']);
$values[]='("$row[id]","$row[userid]""$row[duedate]","$row[status]","$row[firstname]","$row[lastname]","$row[phonenumber]")';
}
mysqli_query($conexion2,'INSERT INTO cobranzaSemanal (idInVoice,idUser,dueDate,status,firstName,lastName,phoneNumber) VALUES '.implode(',',$values)."");
?>
谢谢!
答案 0 :(得分:0)
假设两个数据库的用户名和密码相同,您应该可以将这两个查询组合起来
@Input