XML ファイルを読み取り、データを mysql データベースに挿入するスクリプトがあります。私の問題は、1 つのレコードのみを挿入することであり、60,000 行のデータを挿入する必要があるため、行を挿入するのに 1 時間かかるよりも高速にしたいと考えています。
私のスクリプト
$db_link = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('my_db');
//SIMPLEXML: Cleaned file is opened
$xml_source='cleanme.xml';
$xml=simplexml_load_file($xml_source);
//Reading each tag in the xml file
foreach($xml->Property as $prop){
echo 'Reference '.$prop->Reference.'<br>';
$ref_id=$prop->Reference;
//Reading sub tags in the xml file
foreach($prop->Images->Image as $chk)
{
echo 'REF_ID '.$ref_id.' '.'ImageID '.$chk->ImageID.'<br>';
$sql_refid = $ref_id;
$sql_link =$chk->ImageID;
//Inserts data into to the database
$sql.="INSERT INTO prop_ref (id, ref, link) VALUES (NULL, '{$sql_refid}','{$sql_link}')";
}
}
mysql_query($sql);
echo 'Complete';