note 73357 added to function.mysql-query

From: Date: Mon, 19 Feb 2007 14:29:02 +0000
Subject: note 73357 added to function.mysql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-123577@lists.php.net to get a copy of this message
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 ---- Server IP: 213.92.11.19 Probable Submitter: 193.205.222.88 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-query.php Edit -- https://master.php.net/note/edit/73357 Del: integrated -- https://master.php.net/note/delete/73357/integrated Del: useless -- https://master.php.net/note/delete/73357/useless Del: bad code -- https://master.php.net/note/delete/73357/bad+code Del: spam -- https://master.php.net/note/delete/73357/spam Del: non-english -- https://master.php.net/note/delete/73357/non-english Del: in docs -- https://master.php.net/note/delete/73357/in+docs Del: other reasons-- https://master.php.net/note/delete/73357 Reject -- https://master.php.net/note/reject/73357 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123577) next »