Advertisement
brainode

Read from BD

Feb 10th, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: asus
  5.  * Date: 2/10/14
  6.  * Time: 4:51 PM
  7.  */
  8.  
  9. //namespace core;
  10.  
  11.  
  12. abstract class read extends connect{
  13.     public static function select($bdName,$tableName,$select,$where){
  14.         $connection=connect::connect();
  15.         if(isset($where)&&$where!=false){
  16.             $whereFlag=true;
  17.         }else{
  18.             $whereFlag=false;
  19.         }
  20.         switch($whereFlag):
  21.             case false:
  22.                 $query="SELECT ".$select." FROM ".$bdName.".".$tableName;
  23.                 break;
  24.             case true:
  25.                 $query="SELECT ".$select." FROM ".$bdName.".".$tableName." WHERE ".$where;
  26.                 break;
  27.         endswitch;
  28.         $result=mysqli_query($connection,$query);
  29.         return $result;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement