<?php set_time_limit(0); $con = mysql_connect("host", "user", "pwd"); $dbname = "db"; if ($con) { if (mysql_select_db($dbname, $con)) { $sql = "SHOW TABLES WHERE Tables_in_$dbname not LIKE '%0%';"; $ret = mysql_query($sql); while($row = mysql_fetch_assoc($ret)){ $info1[] = $row["Tables_in_$dbname"]; } foreach ($info1 as $val) { $cmd = "mysqldump --default-character-set=latin1 -u user -h host -ppwd $dbname $val --where='1 limit 100' >> $val.sql"; shell_exec($cmd); } } } mysql_close($con); ?>