Php & Mysql Connection Script


/ Published in: PHP
Save to your folder(s)

All you need to do is put in your database information and then you need to include the config.php file in your project.


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. // MYsql Info
  4. // This is where you put in your mysql host
  5. $db_host = "localhost";
  6. // This is where you put in your mysql username
  7. $db_username = "root";
  8. // This is where you put in your mysql password
  9. $db_password = "";
  10. // This is where you put in your mysql database name
  11. $db_name = "Login";
  12. // Start the Mysql Query
  13. mysql_connect("$db_host","$db_username","$db_password") or die("Sorry we could not connect to our database.");
  14. // Selecting our database from our Mysql Server
  15. mysql_select_db("$db_name") or die("No database");
  16.  
  17.  
  18. //Once you fill out the info you need to connect this script to your project by a simple include.
  19. // Just like this... include_once("config.php");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.