note 73357 deleted from function.mysql-query by philip

From: Date: Fri, 04 Sep 2015 19:22:01 +0000
Subject: note 73357 deleted from function.mysql-query by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203653@lists.php.net to get a copy of this message
Note Submitter: massiv at nerdshack dot com ---- Small change in mysql_dump function, to remove the ";" char at the end of the query. <? function parse_mysql_dump($url, $ignoreerrors = false) { $file_content = file($url); //print_r($file_content); $query = ""; foreach($file_content as $sql_line) { $tsl = trim($sql_line); if (($sql_line != "") && (substr($tsl, 0, 2) != "--") && (substr($tsl, 0, 1) != "#")) { $query .= $sql_line; if(preg_match("/;\s*$/", $sql_line)) { $query = str_replace(";", "", "$query"); $result = mysql_query($query); if (!$result && !$ignoreerrors) die(mysql_error()); $query = ""; } } } } ?> ... Massimo

« previous php.notes (#203653) next »