How to make sure all data are inserted into database?
<p>I have 3400 data and I want to insert all of my data into database. But, it seems some data are skipped during the process. How to make sure all data are inserted.
Thank you.</p>

<p>Here is my code:</p>

<pre><code>&lt;?php  

include 'koneksi.php';
mysql_query("TRUNCATE token");

$komentar=mysql_query("SELECT * FROM dataset_komentar") or die(mysql_error());
$stopwords=mysql_query("SELECT * FROM stopwords") or die(mysql_error());

$index=0;

$arrSw=array();
while ($result1=mysql_fetch_assoc($stopwords)) {
    $arrSw[$index]=$result1['kata'];
    $index++;
}

if (mysql_num_rows($komentar)&gt;0){
    while ($result2=mysql_fetch_assoc($komentar)) {
        $str2=$result2['komentar'];
        $newStr=preg_replace('/[^a-zA-Z]/', ' ', strtolower($str2));
        $newStr=str_replace("'", '', $newStr);

        $token=strtok($newStr, " ");
        $kata="";

        while ($token) {
            for ($i=0; $i&lt;count($arrSw); $i++) { 
                if (trim($arrSw[$i])==$token) {
                    $token="";
                }
            }
            $kata.=$token." ";
            $token=strtok(" ");
            if (!empty($token)) {
                mysql_query("INSERT INTO token VALUES('','$token') ON DUPLICATE KEY UPDATE hasil_token=hasil_token")or die(mysql_error());  
            }
        }
    }
} else {
    echo "No data !";
}?&gt; 
</code></pre>