search

Home  >  Q&A  >  body text

How can I get no data?

 /***

* Get username

*/

 public function left(){

$admin_id = session('admin_id');

$user_name=M("admin");

$user_name=$user_name->where($admin_id )->find();

$this->assign('user_name',$user_name);

$this->display();

}

用户名:<td>{$user_name}</td>

学容错学容错2220 days ago1102

reply all(3)I'll reply

  • 123fan

    123fan2018-10-18 14:42:48

    Where should give the query field, such as where('id',$admin_id)

    reply
    1
  • Summer

    Summer2018-10-18 09:52:26

    First, check whether your $user_name has got a value; then check

    reply
    0
  • 胤彬-

    胤彬-2018-10-18 09:48:30

    Is the where syntax wrong?

    reply
    0
  • Cancelreply