Support Forums
[TUT] Include mySQL into php. - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Database Programming (https://www.supportforums.net/forumdisplay.php?fid=28)
+---- Thread: [TUT] Include mySQL into php. (/showthread.php?tid=116)

Pages: 1 2 3 4 5


RE: [TUT] Include mySQL into php. - Arеs - 11-01-2010

Sorry for bumping this, but I must say this tutorial is awesome.


RE: [TUT] Include mySQL into php. - haphazard - 11-23-2010

You could also install lamp ;)
However this is still a neat tutorial
Thankyou OP


RE: [TUT] Include mySQL into php. - Preeminent - 11-24-2010

Thanks for the tutorial, will help people.


RE: [TUT] Include mySQL into php. - Proof - 11-26-2010

(10-04-2009, 08:51 PM)MyNameIs940 Wrote: Make a settings.inc.php and put this in there:

(CHMOD should be: 755)
PHP Code:
<?
        $CONFIG
['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:
<?
        
include("settings.inc.php");
        
$connection mysql_connect($CONFIG['DBHOST'],
        
$CONFIG['DBUSER'],
        
$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: http://www.supportforums.net/showthread.php?tid=182

You can also just use the define function:

PHP Code:
define("host""HOSTHERE");
define("username""USERNAMEHERE");
define("pass""PASSWORDHERE");
define("db""DATABASENAME"); 



RE: [TUT] Include mySQL into php. - Bursihido - 12-11-2010

Great guide mate THanks.


RE: [TUT] Include mySQL into php. - Spafic - 12-12-2010

Very nice tutorial!

It WILL help me in the future. Big Grin


RE: [TUT] Include mySQL into php. - C!RCU!T tr0jAn ☠ - 12-15-2010

Thanks for this, looks really good. I will use this for revising. Smile


RE: [TUT] Include mySQL into php. - Saint Michael - 12-21-2010

Great beginners tutorial, will use this for reference.


RE: [TUT] Include mySQL into php. - ZxPwn420 - 12-21-2010

Simple but useful script, should help a few newbies at php & mysql.


RE: [TUT] Include mySQL into php. - nextlive - 12-25-2010

Nice tut. Thanks a lot.