开发者

How to Pass Variable inside DQL CodeIgniter

i got a question in DQL how to pass session User id

$vars['mood'] = Doctrine_Query::create()
->select(’m.mood_name, a.id, m.account_id’)
->from(’mood m, m.account a’)
->where(’m.account_id=”7″‘)

i want to 开发者_JAVA技巧show data according to current logged user.

m.account_id=Current_User::user()->id;

this is not working


Session Values in CodeIgniter

The documentation indicates that if you wish to extract a value from the session, you ought to use the following syntax:

$this->load->library("session");
/*...*/
$userid = $this->session->userdata("userid");

WHERE Clause in Doctrine

According to the DQL Documentation, we need only patch that into your where statement:

->where("m.account_id = ?", $userid)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜