Solution : using -w option
set_time_limit(0); $username = "root"; $password = "toor"; $hostname = "localhost"; $sConnString = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $connection = mysql_select_db("Country",$sConnString) or die("Could not select DB"); $sql = "select * from tblkelurahan where left(KelurahanID,4)='3277'"; $query = mysql_query($sql); while ($fetch = mysql_fetch_object($query)) { $namafile = $fetch->KelurahanID; $command = "C:xampp\\mysql\\bin\\mysqldump.exe --add-drop-table -uroot -ptoor -w\"KelurahanID='$namafile'\" Indonesia tblpenduduk > $namafile.sql"; system($command); }