恐怕这听起来多余。我已经尽了我的努力,并至少取代了我迄今发现的三个想法,但没有任何成效。将数组从一个表插入另一个表
目标是合并来自两个表格的唯一字段,但是现在我甚至无法从一个表格获取完全相同的字段,并将其创建为相同的表格。这里是迄今为止的代码,与我的意见:
$result = mysql_query("SELECT * from $db.$tbl LIMIT 50");
if($result) {
while($maindata = mysql_fetch_assoc($result)) {
$newdata = implode ("," , $maindata);
$newdata = mysql_escape_string($newdata);
$pop = "INSERT INTO $db.address_new (id,entitynum,address,city,state,zip,country,remarks)
SELECT FROM $db.address";
//This is the original code replaced by the above
//$pop = "INSERT INTO $db.address_new (id,entitynum,address,city,state,zip,country,remarks)
// VALUES ($newdata)";
mysql_query($pop);
//print_r($pop);
//Seems to give the correct output in the browser, but the table address_new remains empty. `
在此先感谢您。我非常感谢你的帮助。
改变您的查询行'的mysql_query( $ pop)或死(mysql_error());',重新运行,并告诉我们是否有任何错误。 –
@Mark他肯定会得到一个MySQL语法错误。 – cwallenpoole
嗯,我会<在这里插入你的结局>!错误是db.address_new不存在。不过,我可以看到它使用mysqlcc。 – CoffeeBean