View Single Post

  #3 (permalink)  
Old 20-02-2008, 10:32 PM
ghost's Avatar
ghost ghost is offline
Wannabe Geek
 
Join Date: Dec 2007
Location: Ennis
Posts: 166
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ghost will become famous soon enough
Default

Quote:
Originally Posted by Keewee6 View Post
mysql_connect("localhost", "squarebar", "square462") or die(mysql_error());
mysql_select_db("squarebar_db1") or die(mysql_error());
It is also better to put your db connection in a separate file and include it on your working pages.
like this
PHP Code:
$host 'localhost';
$user 'squarebar';
$pass 'square462';
$db 'squarebar_db1';
$con mysql_connect($host$user$pass) or die('ERROR: I Cant find the database!');
mysql_select_db($db) or die('ERROR: still Cant find it fix my db config file!'); 
in your working page do an

include('config.php');
If your Data base ever changes you will only need to make changes in one place
Reply With Quote