daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sqlCommand="select `ID` from `freecomputermarket`.`members` where `UserName`='$this->_userName';";
  2.    
  3. <?php
  4. class MySql
  5. {
  6.     private $_link_Id,$_query_Id,$_serverName,$_userName,$_password,$_dbName,$_rowNum;
  7.  
  8.     public function __construct()
  9.     {
  10.        $this->_serverName="localhost";
  11.        $this->_userName="root";
  12.        $this->_password="";
  13.        $this->_dbName="freecomputermarket";
  14.     }
  15.     public function connect()
  16.     {
  17.        $this->_link_Id=mysql_connect($this->_serverName,$this->_userName,$this->_password);
  18.        if(!$this->_link_Id)
  19.        {
  20.           exit("The Connect is Failed");
  21.        }
  22.        $db_select=mysql_select_db($this->_dbName,$this->_link_Id);
  23.        if(!$db_select)
  24.        {
  25.           exit("Can't Select DataBase");
  26.        }
  27.     }
  28.     public function query($sqlcommand)
  29.     {
  30.        $sqlcommand= addslashes($sqlcommand);
  31.        //echo $sqlcommand;
  32.        $this->_query_Id=mysql_query($sqlcommand,$this->_link_Id);
  33.        exit($this->_query_Id);//print it to check if it is available.
  34.        if(!$this->_query_Id)
  35.           exit("Query failed");
  36.        $this->_rowNum=mysql_affected_rows();
  37.     }
  38.     public function getRow()
  39.     {
  40.        if($this->_rowNum)
  41.        {
  42.           return mysql_fetch_assoc($this->_query_Id);
  43.        }
  44.     }
  45.     public function getAllRows()
  46.     {
  47.        $arr=array();
  48.        $count=0;
  49.        while($count<$this->_rowNum)
  50.        {
  51.           array_push($arr,$this->GetRow());
  52.           $count++;
  53.        }
  54.        return $arr;
  55.     }
  56.     public function getAffectedRowsNumber()
  57.     {
  58.        return $this->_rowNum;
  59.     }
  60. }  
  61. ?>
  62.    
  63. $sqlcommand= addslashes($sqlcommand);
  64.    
  65. //$sqlcommand= addslashes($sqlcommand);
  66. $this->_query_Id=mysql_query($sqlcommand,$this->_link_Id);
  67.    
  68. <?php
  69. class MySql
  70. {
  71.     private $_link_Id,$_query_Id,$_serverName,$_userName,$_password,$_dbName,$_rowNum;
  72.  
  73.     public function __construct()
  74.     {
  75.         $this->_serverName="localhost";
  76.         $this->_userName="root";
  77.         $this->_password="";
  78.         $this->_dbName="freecomputermarket";
  79.     }
  80.     public function connect()
  81.     {
  82.         $this->_link_Id=mysql_connect($this->_serverName,$this->_userName,$this->_password);
  83.         if(!$this->_link_Id)
  84.         {
  85.                                                 exit("The Connect is Failed");
  86.         }
  87.         $db_select=mysql_select_db($this->_dbName,$this->_link_Id);
  88.         if(!$db_select)
  89.         {
  90.                                                 exit("Can't Select DataBase");
  91.         }
  92.     }
  93.     public function query($sqlcommand)
  94.     {
  95.                                         // $sqlcommand= addslashes($sqlcommand);
  96.                                           //echo $sqlcommand;
  97.         $this->_query_Id=mysql_query($sqlcommand,$this->_link_Id);
  98.                                           exit($this->_query_Id);//print it to check if it is available.
  99.         if(!$this->_query_Id)
  100.                                                 exit("Query failed");
  101.         $this->_rowNum=mysql_affected_rows();
  102.     }
  103.     public function getRow()
  104.     {
  105.         if($this->_rowNum)
  106.         {
  107.                                                 return mysql_fetch_assoc($this->_query_Id);
  108.         }
  109.     }
  110.     public function getAllRows()
  111.     {
  112.         $arr=array();
  113.         $count=0;
  114.         while($count<$this->_rowNum)
  115.         {
  116.                                                 array_push($arr,$this->GetRow());
  117.                                                 $count++;
  118.         }
  119.         return $arr;
  120.     }
  121.                     public function getAffectedRowsNumber()
  122.                     {
  123.                         return $this->_rowNum;
  124.                     }
  125. }  
  126. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top