Welcome Guest, Not a member yet? Register   Sign In
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




Theme © iAndrew 2016 - Forum software by © MyBB