<?php
define('DB_NAME', 'yhq');
define('DB_USER', 'root');
define('DB_PASSWORD', '3721');
define('DB_HOST', 'localhost');
$mysql = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("mysql connect fail, wrong password");
mysql_select_db(DB_NAME)or die("select DB fail");
mysql_query("set names utf8");
$fp = fopen("yhq.sql","r") or die('can not open file');
while( $s = fgets( $fp,100000 ) ){
$m .= $s;
}
$sql_content = explode(";\n",$m);
$i = 0;
$max = count($sql_content) ;
while( $i < $max ){
mysql_query( $sql_content [$i] );
if( mysql_error()) echo mysql_error()."<br />";
else{
$n ++;
}
$i ++;
}
echo "<br />mysql queries:".$n;
fclose($fp);
?>