1. Список говнокодов пользователя kkkoi8r

    Всего: 1

  2. PHP / Говнокод #3186

    +167

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    abstract class DataBaseConnection {
      static public  $user   = "root";
      static private $pass   = "";
      static private $host   = "localhost";
      static private $dbName = "example";
    
      //this method creates connection to server and selects data base    
      static public function dbConnect () {
            //initialize connection variables 
            $host   = self :: $host;
            $dbName = self :: $dbName;
            $pass   = self :: $pass;
            $user   = self :: $user;
            // connect to server
            $connection = mysql_connect ( $host, $user, $pass, TRUE ) or die ("DATA BASE CONNECTION FAIL : " . mysql_error());
            // select database
            mysql_select_db ( $dbName, $connection ) or die ("DATA BASE HAS NOT BEEN SELECT");
            //set query encoding
            mysql_query("set names utf8") or die("set names utf8 failed") ;  
            
            return $connection;
      }
    }
    
    DataBaseConnection :: $user = "root";
     
    $connection = DataBaseConnection :: dbConnect ();

    kkkoi8r, 08 Мая 2010

    Комментарии (43)