FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » Ò»¸öSQLITEÊý¾ÝÀà
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Ò»¸öSQLITEÊý¾ÝÀà [message #23686] Sat, 26 March 2005 09:20
jejwe is currently offline  jejwe   China
Messages: 1
Registered: March 2005
Karma: 0
Junior Member
<?
/*
\* ===========================================
\* Ŀ: ҵ
\* : sqlite ݿ
\* 汾: 1.0
\* : 2004//
\* ޸: ---------
\* ------------------------------------------
\* : ΰ
\* ===========================================
*/

//========================================================================= ====
class dbclass{

var $dbname='data/jivi-data';//ݿ
var $err;
//--------ݿ
function open_db(){
$this->db=@sqlite_open($this->dbname,0777);
if(!$this->db){
$this->echoerr("ݿʧ");
}
}

//--------ѯ,ָ
function query_db($query_string){
$this->result=@sqlite_query($this->db,$query_string);
if(!$this->result){
$this->err="query_db";
$this->echoerr("ִ<font color=red>".$query_string."</font>");
}
return $this->result;
}
//---------ƶָ
function sqlite_data_seek($numrow) {
if(!isset($this->result)){
$this->err="sqlite_data_seek";
$this->echoerr("ָδ");
}
if ($numrow==0) {
return sqlite_rewind($this->result);
} else {
return sqlite_seek($this->result, $numrow);
}
}

//---------ָ뽫ɶά
function make_data_array(){
$rows=array();
if(!isset($this->result)){
$this->err="make_data_array";
$this->echoerr("ָδ");
}
while($dbarray=@sqlite_fetch_array($this->result)){
if(!$dbarray){
$this->err="make_data_array";
$this->echoerr("޷");
}
array_push($rows,$dbarray);
}
return $rows;
}

//---------ָ뽫ɹ̶¼Ķά
function make_guding_array($count,$seek){
$rows=array();
$coun=$this->get_numrows();
if(!isset($this->result)){
$this->err="make_guding_array";
$this->echoerr("ָδ");
}
for($i=1;$i<=$count;$i++){
$c=$seek+$i;
if($c>$coun){
break;
}
$dbarray=@sqlite_fetch_array($this->result);
if(!$dbarray){
$this->err="make_guding_array";
$this->echoerr("޷");
}
array_push($rows,$dbarray);
}
return $rows;
}

//----------ü¼
function get_numrows(){
if(!isset($this->result)){
$this->err="numrows";
$this->echoerr("ָδ");
}
return @sqlite_num_rows($this->result);
}

//------------
function echoerr($msg){
$message = "ں<b>$this->err :</b> $msg <br><br>";
$message .= "<b>:</b>".date("d.m.Y @ H:i")."<br>";
$message .= "<b>ű:</b>".getenv("REQUEST_URI")."<br>";
die("$message");
}

function db_close(){
sqlite_close($this->db);
}



}

?>

[Updated on: Sat, 26 March 2005 09:22]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Pop window loads link # and store it in variable
Next Topic: Can someone please explain to me that what is the advantage of using *.inc as extension name?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 11:18:08 GMT 2024

Total time taken to generate the page: 0.02495 seconds