Welcome Guest, Not a member yet? Register   Sign In
PDO in Codeigniter
#6

[eluser]Ickes[/eluser]
[quote author="kgill" date="1246587626"]
$DB =& new PDO($params['dbdriver'].':host='.$params['hostname'].';dbname='.$params['database'], $params['username'], $params['password']);
[/quote]

OK, can I have a little more help?

The arguments to create a new PDO instance are:
new PDO ($dsn, $username, $password, $options)

So as given in the kgill code...
$username = $params['username']
$password = $params['password']

Now I believe the ; should actually be : which gives us
$dsn = $params['dbdriver'].':host='.$params['hostname'].'<b>:</b>dbname='$params['database']

But this isn't working for me. I see:
* $dsn = 'driver://username:[email protected]/database';

so should it be reconfigured to
$params['dbdriver'].'://'.$params['username'].':'.$params['password'].'@'.$params['hostname'].'/'.$params['database']

?

This works but sure seems lengthy and not necessarily correct.

Does anyone have any feedback? Thanks.


Messages In This Thread
PDO in Codeigniter - by El Forum - 07-02-2009, 01:05 PM
PDO in Codeigniter - by El Forum - 07-02-2009, 01:12 PM
PDO in Codeigniter - by El Forum - 07-02-2009, 01:44 PM
PDO in Codeigniter - by El Forum - 07-02-2009, 03:20 PM
PDO in Codeigniter - by El Forum - 07-03-2009, 04:09 PM
PDO in Codeigniter - by El Forum - 07-04-2009, 09:42 AM
PDO in Codeigniter - by El Forum - 07-04-2009, 10:20 AM
PDO in Codeigniter - by El Forum - 07-06-2009, 11:35 AM
PDO in Codeigniter - by El Forum - 07-06-2009, 12:02 PM
PDO in Codeigniter - by El Forum - 07-06-2009, 12:22 PM
PDO in Codeigniter - by El Forum - 07-06-2009, 12:31 PM
PDO in Codeigniter - by El Forum - 07-06-2009, 12:39 PM
PDO in Codeigniter - by El Forum - 07-06-2009, 12:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB