<?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>";
}
}
?>
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
网安追踪流程
1.不用代理网民发帖流程:发帖人 → ISP → 服务器托管商 → 服务器网警追踪流程:网监 → 服务器IP →...
[阅读全文]
-
-
-
HTTP状态码大全
转自:https://www.cnblogs.com/lxinxuan/archive/2009/10/22/1...
[阅读全文]
-
-
-
-
-
网友评论