Closed zaherg closed 12 years ago
The last example is indeed a valid query, but it won't actually work as it would return the field names literally as their values.
Otherwise - when did you checkout the code? That issue must've been fixed a couple of months ago.
i have downloaded the code couple days ago 21/05 ..
i have just downloaded the new code ( today ), but its look like there is a loader problem with MX since i got this
Message: Declaration of MX_Lang::load() should be compatible with that of CI_Lang::load()
so am checking it to see whats wrong .. i have just opened an issue with it http://s.zah.me/Kcxwfl
i have downloaded the new code ( 24/05/2012) and i have confirm that this issue is not resolved yet ..
Well, I can't see how it could be a CI issue. It's most likely one in that ion_auth library that you're using. Could you check on that?
P.S.: GitHub has pretty friendly URLs and adding a link to an issue is as easy as prefixing it's number with '#'. Please don't use URL shorteners. :)
i dont think its something related to the ion_auth, since its working fine with mysql and mysqli and right now am using mysqli and its working fine ..
the function which used to return the last select statement is :
<?php
public function user($id = NULL)
{
$this->trigger_events('user');
//if no id was passed use the current users id
$id || $id = $this->session->userdata('user_id');
$this->limit(1);
$this->where($this->tables['users'].'.id', $id);
$this->users();
return $this;
}
which as you can use is a normal AR statement ..
PS : about the url , i will do it as you like :D
This code only shows us the WHERE and LIMIT clauses. The possible issue is in either where SELECT and FROM are or that the PDO driver's constructor isn't executed. Most likely the second one.
Hey, I'll be glad to help clarify anything with Ion Auth. Here are the two methods that are executed with this:
public function users($groups = NULL)
{
$this->trigger_events('users');
//default selects
$this->db->select(array(
$this->tables['users'].'.*',
$this->tables['users'].'.id as id',
$this->tables['users'].'.id as user_id'
));
if (isset($this->_ion_select))
{
foreach ($this->_ion_select as $select)
{
$this->db->select($select);
}
$this->_ion_select = array();
}
//filter by group id(s) if passed
if (isset($groups))
{
//build an array if only one group was passed
if (is_numeric($groups))
{
$groups = Array($groups);
}
//join and then run a where_in against the group ids
if (isset($groups) && !empty($groups))
{
$this->db->join(
$this->tables['users_groups'],
$this->tables['users_groups'].'.user_id = ' . $this->tables['users'].'.id',
'inner'
);
$this->db->where_in($this->tables['users_groups'].'.group_id', $groups);
}
}
$this->trigger_events('extra_where');
//run each where that was passed
if (isset($this->_ion_where))
{
foreach ($this->_ion_where as $where)
{
$this->db->where($where);
}
$this->_ion_where = array();
}
if (isset($this->_ion_limit) && isset($this->_ion_offset))
{
$this->db->limit($this->_ion_limit, $this->_ion_offset);
$this->_ion_limit = NULL;
$this->_ion_offset = NULL;
}
else if (isset($this->_ion_limit))
{
$this->db->limit($this->_ion_limit);
$this->_ion_limit = NULL;
}
//set the order
if (isset($this->_ion_order_by) && isset($this->_ion_order))
{
$this->db->order_by($this->_ion_order_by, $this->_ion_order);
$this->_ion_order = NULL;
$this->_ion_order_by = NULL;
}
$this->response = $this->db->get($this->tables['users']);
return $this;
}
/**
* user
*
* @return object
* @author Ben Edmunds
**/
public function user($id = NULL)
{
$this->trigger_events('user');
//if no id was passed use the current users id
$id || $id = $this->session->userdata('user_id');
$this->limit(1);
$this->where($this->tables['users'].'.id', $id);
$this->users();
return $this;
}
OK, this is getting us nowhere ... where can I download this library from?
The library is here: https://github.com/benedmunds/CodeIgniter-Ion-Auth
On a clean CodeIgniter installation, with MySQL via PDO:
$this->load->library('ion_auth');
$this->ion_auth->user()->row();
... this is the query that Ion_Auth generates for me:
SELECT `users`.*, `users`.`id` as id, `users`.`id` as user_id FROM `users` WHERE `users`.`id` = 0 LIMIT 1
@linuxjuggler You've probably put the downloaded code in the wrong place.
@narfbg am using CI with MX and the library is inside the libraries directory inside the main app folder .. so i dont think there is something wrong with my installation .. am on windows xampp ..
any way will check it again ..
I don't know what MX is, but at least _system/database/drivers/pdo/pdodriver.php is not the latest version.
MX is the modules library .. and yes pdo_driver.php is the latest version since i have deleted the system directory and copied the new one ..
any way i will make more research and get back to you ..
hi, am using the new 3.0-dev version, i have enabled the pdo in my database connection .. am using ion_auth library and when i try to do this :
i got this error :
and when i try to login :
i got this error
after some testing i have noticed this that this :
will not work, but this :
and this will not work :
but this will do work ( notice the change in "users" )