daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Sep 23rd, 2016 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Database connection
  2.  
  3. To store data, you would need a database. In this case we would be using MySQL database.
  4.  
  5. ```php
  6.  <?php
  7.     $DBNAME = 'dbname';
  8.     $HOST   = 'localhost';
  9.     $DBUSER = 'dbuser';
  10.     $DBPASS = 'dbpass';
  11.    
  12.     $CONNECT = mysql_connect($HOST,$DBUSER,$DBPASS);
  13.     if(!$CONNECT) {
  14.         echo 'MySQL Error: '.mysql_error();
  15.     }
  16.    
  17.     $SELECT = mysql_select_db($DBNAME);
  18.     if(!$SELECT) {
  19.         echo 'MySQL Error: '.mysql_error();
  20.     }
  21.   ?>
  22. ```
  23.  
  24. In the highlighted lines above, you would have to specify your own server database details.  
  25.  
  26. You can save the above file as config.php and you would have to include that file in all pages where you need database connectivity.
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