A Databse Handling Class In Php

Now this is the age of RAD (Rapid App Development Tool). To run faster in web development thins class may help you. This is simply a DBHANDLER class .

We suggest you to use the DBHANDLER Class and find its amazing potential in the modern age that is primarily governed by Rapid Application Development Tools.

class __dbConfigSys

{

var $LINK=”; var $NON=’DD’;

var $HOST=”; var $USER=”; var $PASS=”; var $DB=”;

var $ERROR=”;

function  __dbConfigSys($DBHOST,$DBUSER,$DBPASS,$DBNAME) {

$this->HOST=$DBHOST; $this->USER=$DBUSER; $this->PASS=$DBPASS; $this->DB=$DBNAME;

}

function mySQLConnet() {

$LINK= @mysql_pconnect($this->HOST,$this->USER,$this->PASS,65536);

if(!$LINK) {

$this->ERROR['MYSQL_PCONNECT']=’LINE 12 :’ . mysql_error() . ‘ . [mySQLConnet]‘;

return 0;

} else {

$this->LINK=$LINK;

$SELDB=@mysql_select_db($this->DB,$LINK);

if(!$SELDB) {

$this->ERROR['MYSQL_SELECT_DB']=’LINE 18 :’ . mysql_error() . ‘ . [mySQLConnet]‘;

return -1;

} else {

return $SELDB;

}

}

}

function executeNonQuery($QUARY) {

if($QUARY==”) {

$this->ERROR['QUARY_NULL']=’LINE 28 : NO QUERY SENT IN THE FUNCTION [executeNonQuery]‘;

return 0;

} else {

$this->mySQLConnet();

$SELDB=@mysql_query($QUARY);

if(!$SELDB) {

$this->ERROR['MYSQL_QUARY']=’LINE 34 : PLEASE CHECK THE QUERY [ ' . $QUARY . ' ]. ‘ . mysql_error() . ‘ . [executeNonQuery]‘;

} else {

mysql_close($this->LINK);

return 1;

}

}

}

function resultSET($QUARY) {

if($QUARY==”) {

$this->ERROR['QUARY_NULL']=’LINE 44 : NO QUERY SENT IN THE FUNCTION [executeNonQuery]‘;

return 0;

} else {

$this->mySQLConnet();

$SELDB=mysql_query($QUARY);

if(!$SELDB) {

$this->ERROR['QUARY_ERROR']=’LINE 50 : PLEASE CHECK THE QUERY [ ' . $QUARY . ' ]. ‘ . mysql_error() . ‘ . [resultSET]‘;

} else {

while($RESULTSET=mysql_fetch_array($SELDB)) {

$RECORDSET[]=$RESULTSET;

}

mysql_close($this->LINK);

return $RECORDSET;

}

}

}

function noofRECORDS($QUARY) {

if($QUARY==”) {

$this->ERROR['QUARY_NULL']=’LINE 44 : NO QUERY SENT IN THE FUNCTION [executeNonQuery]‘;

return 0;

} else {

$this->mySQLConnet();

$SELDB=@mysql_query($QUARY);

if(!$SELDB) {

$this->ERROR['QUARY_ERROR']=’LINE 50 : PLEASE CHECK THE QUERY [ ' . $QUARY . ' ]. ‘ . mysql_error() . ‘ . [resultSET]‘;

} else {

return @mysql_num_rows($SELDB);

}

}

}

function lastID() {

$this->mySQLConnet();

return mysql_insert_id();

}

function __debug() {

$MSG=’<div style=”margin-top:10px margin-buttom:10px; border:1px dashed #000000; background-color:#d8d8d8;”><ul>’;

if($this->ERROR!=”) {

foreach($this->ERROR as $KEY=>$VALUE) {

$MSG.= ‘<li style=”font-family:verdana; font-size:12px; color:#ff0000;”>’ . $KEY .’: ‘ .  $VALUE . ‘</li>’;

}

echo $MSG . ‘</ul></div>’;

} else {

echo ‘<div style=”margin-top:10px margin-buttom:10px; border:1px dashed #000000; background-color:#d8d8d8; font-family:verdana; font-size:12px; color:#ff0000;”>SUCCESS. CONTINUE</div>’;

}

}

function check_email($mail_address) {

$pattern = “/^[\w-]+(\.[\w-]+)*@”;

$pattern .= “([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i”;

if (preg_match($pattern, $mail_address)) {

$parts = explode(“@”, $mail_address);

if (checkdnsrr($parts[1], “MX”)){

return “1″;

// return true;

} else {

return “The e-mail host is not valid.”;

// return false;

}

} else {

return “The e-mail address contains invalid charcters.”;

// return false;

}

}

}

One Response to “A Databse Handling Class In Php”

  1. Even being in the lighting segment, Valparaiso Landscape Lighting must acknowledge the necessity of such programming

Leave a Reply