By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,374 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,374 IT Pros & Developers. It's quick & easy.

Restoring MySQL dump

P: 2
How to get mysql to comply with all instructions from a file? Ransacked the entire forum, tried everything I could find, but the instructions are not executed.
Here is the code:
Code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     /* Connecting, selecting database */
  3.     $link = mysql_connect("localhost", "root", "")
  4.         or die("Could not connect");
  5.     print "Connected successfully";
  6.     mysql_select_db("000") or die("Could not select database");
  7.  
  8. parse_mysql_dump function($url, $ignore errors = false) { 
  9.    $file_content = file($url); 
  10.    //print_r($file_content); 
  11.    $query = ""; 
  12.    foreach($file_content as $sql_line) { 
  13.      $tsl = trim($sql_line); 
  14.           if (($sql_line != "") && (substr($tsl, 0, 2) != "--") && (substr($str, 0, 1) != "#")) { 
  15.        $query .= $sql_line; 
  16.        if(preg_match("/;\s*$/", $sql_line)) { 
  17.          $result = mysql_query($query); 
  18.          if (!$result && !$ignoreerrors) die(mysql_error()); 
  19.          $query = ""; 
  20.        } 
  21.      } 
  22.    } 
  23.   }
  24.  
  25. if(parse_mysql_dump("2.sql")) echo "YES!";
  26. else echo "NO!";
  27. ?>
Jan 29 '18 #1

✓ answered by cheesecake

Hello ))) you can also try to use the recovery services . like for example mysql recovery .

Share this Question
Share on Google+
2 Replies


P: 1
Hello ))) you can also try to use the recovery services . like for example mysql recovery .
Jan 31 '18 #2

P: 2
Hello , now I will try , thanks for the reply , I had never used a recovery service
Jan 31 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.