Before the question , How to using php to get unique word pair(string) and insert into mysql table should read first
for example:
if we have dog cat pair , we will not see cat dog
As @pala_ suggestion here 's my code
$sql= "INSERT INTO EM (source,target) VALUES ";
$res = array();
foreach($combine_words_array as $v1) {
foreach($combine_words_array as $v2) {
$t = array($v1, $v2);
asort($t);
if(!in_array($t, $res)){
$res[] = $t;
$sql.="('$t[0]','$t[1]'),";
mysql_query(substr($sql,0,-1));
}
}
}
and question appear, this array must very huge and MySQL insert stop at 540000
rows ,is any idea that could use array dynamic or together with MySQL code?