MySQL Dump To Database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MySQL Dump To Database

    1. // open the some.sql file
    2. $fp = @fopen("some.sql", "r");
    3. $file = fread($fp, 80000);
    4. fclose($fp);
    5. $lines = explode(';', $file);
    6. $cnt = count($lines);
    7. // database connection
    8. mysql_connect("localhost","root","pass");
    9. for($j=0; ($j<$cnt-1); $j ) {
    10. if(!mysql_query($lines[$j])) {
    11. echo "error on line $j of query:<br>";
    12. echo $lines[$j]."<br />";
    13. die;
    14. }
    15. }
    16. echo "done";
    http://ngeo.ro
Working...
X