the+mysql+extension_解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be rem...

cb74527c00f4bf1d5f83bcfd086ec3a3.png

谁能帮我吗

926/07/2015 下午 8:475楼

能帮我改改吗?

exec($sql) )return array();

if( ! mysql_num_rows($result) )return array();

$rows = array();

while($rows[] = mysql_fetch_array($result,MYSQL_ASSOC)){}

mysql_free_result($result);

array_pop($rows);

return $rows;

}

public function newinsertid()

{

return mysql_insert_id($this->conn);

}

public function showtables($tables)

{

return mysql_num_rows(mysql_query(“show tables like ‘%”.$tables.”%'”,$this->conn));

}

public function setlimit($sql, $limit)

{

return $sql. ” LIMIT {$limit}”;

}

public function exec($sql)

{

$this->arrSql[] = $sql;

if( $result = mysql_query($sql, $this->conn) ){

return $result;

}else{

if(mysql_error()!=”){

syError(“{$sql}执行错误: ” . mysql_error());

}else{

return TRUE;

}

}

}

public function affected_rows()

{

return mysql_affected_rows($this->conn);

}

public function getTable($tbl_name)

{

return $this->getArray(“DESCRIBE {$tbl_name}”);

}

public function __construct($dbConfig)

{

$linkfunction = ( TRUE == $dbConfig[‘persistent’] ) ? ‘mysql_pconnect’ : ‘mysql_connect’;

$this->conn = $linkfunction($dbConfig[‘host’].”:”.$dbConfig[‘port’], $dbConfig[‘login’], $dbConfig[‘password’]);

if(!$this->conn || !mysql_select_db($dbConfig[‘database’], $this->conn)){

echo ‘数据库无法链接,如果您是第一次使用,请先执行安装程序网润科技建站程序 m.cqbaidu.com‘;exit;

}

$this->exec(“SET NAMES UTF8”);

if($this->version() > ‘5.0.1’) {

$this->exec(“set sql_mode=””);

}

}

public function version() {

return mysql_get_server_info($this->conn);

}

public function __val_escape($value) {

return ‘\”.$value.’\”;

}

public function __destruct()

{

if( TRUE != $GLOBALS[‘G_DY’][‘db’][‘persistent’] )@mysql_close($this->conn);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值