对一些低版本运行的php程序改造或许会有些用哦
//--高版本的mysql支持
$dbhost = DB_HOST;
$dbport = 3306;
$dbuser = DB_USER;
$dbpass = DB_PASSWD;
$dbname = DB_NAME;
if(!function_exists('mysql_connect')){
function mysql_connect($dbhost, $dbuser, $dbpass){
global $dbport;
global $dbname;
global $mysqli;
$mysqli = mysqli_connect("$dbhost:$dbport", $dbuser, $dbpass, $dbname);
return $mysqli;
}
function mysql_select_db($dbname){
global $mysqli;
return mysqli_select_db($mysqli,$dbname);
}
function mysql_fetch_array($result){
return mysqli_fetch_array($result);
}
function mysql_fetch_assoc($result){
return mysqli_fetch_assoc($result);
}
function mysql_fetch_row($result){
return mysqli_fetch_row($result);
}
function mysql_query($query){
global $mysqli;
return mysqli_query($mysqli,$query);
}
function mysql_escape_string($data){
global $mysqli;
return mysqli_real_escape_string($mysqli, $data);
}
function mysql_real_escape_string($data){
return mysql_real_escape_string($data);
}
function mysql_close(){
global $mysqli;
return mysqli_close($mysqli);
}
function mysql_num_rows($result){
return mysqli_num_rows($result);
}
function mysql_num_fields($result){
return mysqli_num_fields($result);
}
function mysql_insert_id(){
global $mysqli;
return $mysqli->insert_id;
}
function mysql_error(){
global $mysqli;
return mysqli_error($mysqli);
}
function mysql_errno(){
global $mysqli;
return mysqli_errno($mysqli);
}
function mysql_affected_rows(){
global $mysqli;
return mysqli_affected_rows($mysqli);
}
function mysql_get_server_info(){
global $mysqli;
return mysqli_get_server_info($mysqli);
}
define('MYSQL_ASSOC',0);
}
评论 (0)