-
-
$db = mysql_connect(....);
- mysql_select_db(....);
$fp = fopen('somefile.sql' , 'r');
- while($fp != feof())
- {
- $line = fread($fp, 2048);
- $line = mysql_real_escape_string($db, $line);
- mysql_query($line) ;
- }
- fclose($fp);
-
Copy code
2, method 2 of importing sql files in PHP:
Reference links:
http://www.phpclasses.org/browse/file/24767.html
3. Method 3 of importing sql files in PHP:
-
- exec("SOURCE path/to/*.sql")
Copy code
|