Jump to content

[SOLVED] Executing .sql file


AV

Recommended Posts

#thorpe

As PHP_PhREEEK said, I either have not privilleges to use exec()

 

#MadTechie

$url = file_get_contents('db_data.sql');

 function parse_mysql_dump($url, $ignoreerrors = false) {
  $file_content = file($url);
  $query = "";
  foreach($file_content as $sql_line) {
    $tsl = trim($sql_line);
    if (($tsl != "") && (substr($tsl, 0, 2) != "--") && (substr($tsl, 0, 1) != "#")) {
      $query .= $sql_line;
      if(preg_match("/;\s*$/", $sql_line)) {
        $result = mysql_query($query);
        if (!$result && !$ignoreerrors) die(mysql_error());
        $query = "";
      }
    }
  }
 }

Doesn't work either, no errors.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.