Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TUT] Include mySQL into php.
#31
Sorry for bumping this, but I must say this tutorial is awesome.
Reply
#32
You could also install lamp ;)
However this is still a neat tutorial
Thankyou OP
slowly getting better
Reply
#33
Thanks for the tutorial, will help people.
Reply
#34
(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"); 
(11-23-2010, 08:40 PM)Guest Wrote: Alright, did the 'Support' get removed from SupportForums?
You're not a good Emotional Helper.
Reply
#35
Great guide mate THanks.
Reply
#36
Very nice tutorial!

It WILL help me in the future. Big Grin
Reply
#37
Thanks for this, looks really good. I will use this for revising. Smile
[Image: logo2.png]
Reply
#38
Great beginners tutorial, will use this for reference.
[Image: angelsig.jpg]


Reply
#39
Simple but useful script, should help a few newbies at php & mysql.
Reply
#40
Nice tut. Thanks a lot.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  vb6.0 + mysql Anurag.91 1 1,792 09-08-2012, 04:19 PM
Last Post: spesificrelax
  Creating and inserting data into a PHP and MySQL Database Peter L 9 4,644 03-24-2012, 10:49 AM
Last Post: Haxalot
  VB.NET MySql , Help please booterphhp 2 1,875 03-19-2012, 11:13 AM
Last Post: RainbowDashFTW
  MySQL (Innodb vs MyISAM) Omniscient 15 10,758 07-22-2011, 03:15 PM
Last Post: developer99
  MySQL question ImFocuzz 8 3,148 07-17-2011, 06:57 PM
Last Post: Pedo bear

Forum Jump:


Users browsing this thread: 3 Guest(s)