Error de Codigo PHP

1 view
Skip to first unread message

Nelson o mesmo

unread,
Apr 30, 2014, 3:47:45 AM4/30/14
to nelson o mesmo


Hello, I'm having trouble selecting items from a given category, is returning the following error:

  syntax error, unexpected '->' (T_OBJECT_OPERATOR)


my code:

$categorias = DB::table('categorias')->lists('id');
 $artigos = DB::table('artigos')->where('categoria_id', '=', array($categorias)->toArray());
 #var_dump($artigos);

Yuri Teixeira

unread,
Apr 30, 2014, 3:26:50 PM4/30/14
to phpba...@googlegroups.com, nelson o mesmo
O problema está aqui: 

array($categorias)->toArray()

arrays não são objetos, logo, chamar toArray() vai resultar nesse erro.

2014-04-30 9:47 GMT+02:00 Nelson o mesmo <nelsonph...@gmail.com>:
array($categorias)->toArray()


Reply all
Reply to author
Forward
0 new messages