Connect to mysql database from php

If you need to connect to a mysql database from php you can do it like this:

<?php>
   $DBH = ‘localhost’;
   $DBU = ‘root’;
   $DBPWD = ‘password’;
   $DBN = ‘petstore’;
   $conn = mysql_connect($DBH, $DBU, $DBPWD) or die  ("Error: Could not connect to database.");
   mysql_select_db($dbname);
?>

This allows you to make a connection to the mysql database and gets it ready for you to make queries and manipulate the data.


Share This Article

Related Posts

Comments

There are no comments on this entry.

Trackbacks

There are no trackbacks on this entry.

Add a Comment

Required

Required

Optional

Latest Domains

1. weebly.com
(1 day ago)
2. whpromotions.co.uk
(1 day ago)
3. adsl24.co.uk
(1 day ago)
4. youryoungmodels.net
(1 day ago)
5. enom.com
(1 day ago)
6. dynect.net
(1 day ago)
7. websitewelcome.com
(1 day ago)
8. hostgator.com
(1 day ago)
9. uploading.com
(2 days ago)
10. soccernetghana.com
(2 days ago)

Services

PHP MySQL Apache Flash Air Java C++ Python