Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TUT] Include mySQL into php.
#4
Hmm... Shorthand? Yuck.
Heres how I connect to my databases

Code:
<?php
class connection {
    private $database, $connect;
    function connect() {
        $this->database = array(
        'username' => 'USERNAME',
        'password' => 'PASSWORD',
        'host' => 'localhost',
        'name' => 'DATABASE NAME'
        );

        $this->connect = mysql_connect($this->database['host'], $this->database['username'], $this->database['password']);
        mysql_select_db($this->database['name'], $this->connect);
    }
}

$db = new connection();
$db->connect();
?>
Reply


Messages In This Thread
[TUT] Include mySQL into php. - by MyNameIs940 - 10-04-2009, 08:51 PM
RE: [TUT] Include mySQL into php. - by FBI - 10-05-2009, 09:44 AM
RE: [TUT] Include mySQL into php. - by xiofire - 10-05-2009, 05:30 PM
RE: [TUT] Include mySQL into php. - by wat - 12-21-2009, 01:21 PM
RE: [TUT] Include mySQL into php. - by immi - 10-06-2009, 08:48 AM
RE: [TUT] Include mySQL into php. - by xiofire - 10-06-2009, 02:29 PM
RE: [TUT] Include mySQL into php. - by GizSho - 10-07-2009, 03:20 PM
RE: [TUT] Include mySQL into php. - by El Zorro - 10-08-2009, 03:34 PM
RE: [TUT] Include mySQL into php. - by HuNt3R - 10-08-2009, 06:07 PM
RE: [TUT] Include mySQL into php. - by Legion - 10-09-2009, 02:11 PM
RE: [TUT] Include mySQL into php. - by manipulate - 12-17-2009, 03:53 AM
RE: [TUT] Include mySQL into php. - by Extasey - 12-17-2009, 03:58 AM
RE: [TUT] Include mySQL into php. - by spiro_dt - 12-17-2009, 10:57 AM
RE: [TUT] Include mySQL into php. - by Password - 01-15-2010, 10:19 AM
RE: [TUT] Include mySQL into php. - by Gaijin - 01-15-2010, 10:50 AM
RE: [TUT] Include mySQL into php. - by Password - 01-16-2010, 08:14 PM
RE: [TUT] Include mySQL into php. - by Gaijin - 01-16-2010, 08:28 PM
RE: [TUT] Include mySQL into php. - by Password - 01-17-2010, 02:07 AM
RE: [TUT] Include mySQL into php. - by Gaijin - 01-17-2010, 05:20 AM
RE: [TUT] Include mySQL into php. - by Password - 01-18-2010, 07:42 AM
RE: [TUT] Include mySQL into php. - by ShuTdown - 04-25-2010, 05:18 AM
RE: [TUT] Include mySQL into php. - by pers2981 - 09-09-2010, 06:17 PM
RE: [TUT] Include mySQL into php. - by Shirosaki. - 10-03-2010, 07:32 AM
RE: [TUT] Include mySQL into php. - by Arеs - 11-01-2010, 09:14 AM
RE: [TUT] Include mySQL into php. - by haphazard - 11-23-2010, 08:42 PM
RE: [TUT] Include mySQL into php. - by Preeminent - 11-24-2010, 04:40 AM
RE: [TUT] Include mySQL into php. - by Proof - 11-26-2010, 08:29 AM
RE: [TUT] Include mySQL into php. - by Bursihido - 12-11-2010, 04:15 PM
RE: [TUT] Include mySQL into php. - by Spafic - 12-12-2010, 12:41 AM
RE: [TUT] Include mySQL into php. - by ZxPwn420 - 12-21-2010, 11:39 PM
RE: [TUT] Include mySQL into php. - by nextlive - 12-25-2010, 10:47 AM
RE: [TUT] Include mySQL into php. - by Break - 01-05-2011, 11:49 AM
RE: [TUT] Include mySQL into php. - by Element - 02-26-2011, 02:49 PM
RE: [TUT] Include mySQL into php. - by spark™ - 04-25-2011, 12:02 AM
RE: [TUT] Include mySQL into php. - by harris21 - 04-26-2011, 07:13 AM
RE: [TUT] Include mySQL into php. - by hacker2012 - 05-24-2011, 10:06 PM
RE: [TUT] Include mySQL into php. - by Legit - 05-31-2011, 09:15 AM
RE: [TUT] Include mySQL into php. - by !LoL - 06-01-2011, 04:10 AM
RE: [TUT] Include mySQL into php. - by Strafeness - 01-14-2012, 04:45 PM

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

Forum Jump:


Users browsing this thread: 2 Guest(s)