Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Jacob Mahto
Added: Mar 25, 2018 12:48 PM
Modified: Mar 25, 2018 12:55 PM
Views: 29
Absurd method to connect to database
  1. <?php
  2. $db['db_host'] = "localhost";
  3. $db['db_user'] = "root";
  4. $db['db_pass'] = "lion";
  5. $db["db_name"] = "cms";
  6.  
  7. foreach($db as $key => $value){
  8.     define(strtoupper($key),$value);    
  9. }
  10.  
  11. $connection = mysqli_connect(DB_HOST,DB_USER,DB_PASS,DB_NAME);
  12.  
  13. if($connection){
  14.     echo "Connected";
  15. }