Support Forums

Full Version: [TUT] Include mySQL into php.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Sorry for bumping this, but I must say this tutorial is awesome.
You could also install lamp ;)
However this is still a neat tutorial
Thankyou OP
Thanks for the tutorial, will help people.
(10-04-2009, 08:51 PM)MyNameIs940 Wrote: [ -> ]Make a and put this in there:

(CHMOD should be: 755)
PHP Code:
['DBHOST'] = "localhost"// Database servers location, normally localhost
$CONFIG['DBUSER'] = "username"// sql user
$CONFIG['DBPASS'] = "password"// db users password
$CONFIG['DBNAME'] = "database"// Database to connect to

then make database.php

(CHMOD should be: 644)
PHP Code:
$connection mysql_connect($CONFIG['DBHOST'],
$CONFIG['DBPASS']) or die("Could not establish a connection with mysql.");
mysql_select_db($CONFIG['DBNAME']) or die("Unable to select database.");

Then in all your codes put:

PHP Code:
<? include("database.php"); ?>

You are done Big Grin

Note: If you need help with CHMOD visit this link:

You can also just use the define function:

PHP Code:
Great guide mate THanks.
Very nice tutorial!

It WILL help me in the future. Big Grin
Thanks for this, looks really good. I will use this for revising. Smile
Great beginners tutorial, will use this for reference.
Simple but useful script, should help a few newbies at php & mysql.
Nice tut. Thanks a lot.
Pages: 1 2 3 4 5