lundi 29 juin 2015

random database connection (php)

Trying to make random database connection, but always getting errors. I Didn't know how to work with public static variable in class.

class DB {


    $dbs = array("data_base1","data_base2","data_base3"); 
    $dbs = $dbs[rand(0, count($dbs)-1)];

    // initial connection
    public static $dbName='$dbs';
    public static $user='$dbs';
    public static $password = 'pass123';
    public static $host = 'localhost';




Aucun commentaire:

Enregistrer un commentaire