mysql类库php_php MySQL类

[php]代码库< ? Class MySQL { var $host; var $user; var $passwd; var $database;

function MySQL()

//利用构造函数实现变量初始化

{ $host = "";

$user = "";

$passwd = "";

$database = "";

}

function Connect()

{ $conn = MySQL_connect($this->host, $this->user,$this->passwd)

or die("Could not connect to $this->host");

MySQL_select_db($this->database,$conn) or die("Could not switch to database $this->database;");

return $conn;

}

function Close($conn) {

MySQL_close($conn);

}

function Query($queryStr, $conn)

{

$res =MySQL_query($queryStr, $conn) or die("Could not query database");

return $res;

}

function getRows($res)

{

$rowno = 0;

$rowno = MySQL_num_rows($res);

if($rowno>0)

{

for($row=0;$row

{

$rows[$row]=MySQL_fetch_row($res);

}

return $rows;

}

}

function getRowsNum($res)

{

$rowno = 0;

$rowno = mysql_num_rows($res); return $rowno;

} } ? >

694748ed64b9390909c0d88230893790.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值