• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PDO connection and values

#1
To connect with PDO this is not working:
(https://codeigniter.com/user_guide/datab...cting.html)
$db['pdo'] = array(
'dsn' => 'mysql:host=localhost;dbname=your_db_name',
// remaining configs
);

This works:
$db['pdo'] = array(
'dsn' => '',
'hostname' => 'mysql:host=localhost;dbname=your_db_name',
'username' => 'user_name',
'password' => 'password',
'database' => '',
'dbdriver' => 'pdo'
// remaining configs
);

Why is that?

If i run this query the num_rows is 1 but the result is empty:
$sql = "SELECT id, username, password FROM {pre}dashboard_users WHERE username = ? AND password = ? LIMIT 1";
$query = $this->db->query($sql, array($username, md5($password)));

if($query->num_rows() == 1)
{
return $query->result();
} else {
return false;
}

what am i doing wrong?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.