php7 兼容 MySQL 相关函数
PHP7 废除了 ”mysql.dll” ,推荐使用 mysqli 或者 pdo_mysql
http://PHP.net/manual/zh/mysqlinfo.api.choosing.php
http://blog.csdn.NET/beimuaihui/article/details/50235907
- // *************** PHP7 START ***************
- if(!function_exists('mysql_pconnect')){
- function mysql_pconnect($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($cxn){
- global $mysqli;
- return mysqli_query($mysqli,$cxn);
- }
- 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);
- }
- }