我想将我的 MS Access 数据导入 MySQL 数据库。我正在使用xampp
. 我编写了获取 Access 表并创建查询字符串的 PHP 代码。当我执行我的程序时,它给了我以下错误:
内存不足(需要 2465528 字节)
我的代码是:
<?php
$conn=odbc_connect('my','','');/* connected */
$sql="SELECT * FROM mytable";
$rs=odbc_exec($conn,$sql);
$sqlstr="";
$tablefields=array("Name","City","State");
$sqlstr="INSERT INTO `mytable`(";
$temp=0;
for($i=0;$i<count($tablefields)-1;$i++)
{
$sqlstr.="`".$tablefields[$i]."`";
if($temp==count($tablefields)-2)
{
}
else
{
$sqlstr.=",";
$temp++;
}
}
$sqlstr.=") VALUES";
//echo $sqlstr;
//return;
$sqlstr.="(";
while($row = odbc_fetch_array($rs))
{
$temp=0;
foreach ($row as $key => $value)
{
$sqlstr.="'".$value."'";
if($temp==count($row)-1)
{
$sqlstr.="),(";
}else
{
$sqlstr.=",";
$temp++;
}
//echo $sqlstr;
}
}
$sqlstr.=")";
connection();
$res=mysql_query($sqlstr)or die (mysql_error());
function connection()
{
$host="localhost";
$user="root";
$pass="";
$database="mydatabase";
$cnx=mysql_connect($host, $user, $pass);
mysql_connect($host, $user, $pass);
echo (mysql_error($cnx));
mysql_select_db($database, $cnx);
echo (mysql_error($cnx));
return $cnx;
}
?>
我
确实改变max_execution_time = 3600
了memory_limit = -1
php.ini
my.ini
key_buffer = 200M
sort_buffer_size = 200M
read_buffer = 200M
write_buffer = 200M
谁能告诉我问题出在哪里?