源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

一个MYSQL操作类

  • 时间:2022-09-28 03:05 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:一个MYSQL操作类
[u]复制代码[/u] 代码如下:
<?php class DB{     var $host_addr = "localhost"; var $host_user = "root"; var $host_psw  = "123"; var $db_name   = "test"; var $link_id; var $query_id; var $numRow; function DB(){      $this->link_id = @mysql_connect($this->host_addr,$this->host_user,$this->host_psw);   if($this->link_id){       @mysql_select_db($this->db_name,$this->link_id) or $this->halt("数据库连接失败!");   }else{       $this->halt("连接服务器失败!");    return false;   }   return $this->link_id; } function query($sql){      $this->query_id = @mysql_query($sql,$this->link_id);   if($this->query_id){       return $this->query_id;   }else{       $this->halt("SQL Error::");    return false;   } } function numRow(){      return $this->numRow = @mysql_num_rows($this->query_id); } function close(){      return @mysql_close($this->link_id); } function halt($msg){      echo "<font color=\"#FF0000\">".$msg."</font>"; } } ?>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部