0

I have a problem with this code, any help?

$var = reset($sql -> select(array(
  'table' => 'news',
  'join' => array('table' => 'story', 'where' => 'id = post_id'),
  'where' => array("id = $id", 'or', "url = $id")
)));

Error:

Strict Standards: Only variables should be passed by reference in

$query = reset(  
    $sql->select(array(  
        'table'     => 'news',  
        'where'     => $where  
)));   
Strict Standards: Only variables should be passed by reference in
β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83

1 Answers1

1

Take a look here.

reset() function is waiting for a variable reference, instead you are passing it a function result.
For more info see php reset docs

You can, extract the result of the function and then pass it to reset() as shown below.

$select = $sql -> select(array(
  'table' => 'news',
  'join' => array('table' => 'story', 'where' => 'id = post_id'),
  'where' => array("id = $id", 'or', "url = $id")
))
$var = reset($select);

Then the other one:

$select1 = $sql->select(array(
             'table'      => 'news',
             'where'      => $where
            ));
$query = reset($select1);

PHP live demo

Dwhitz
  • 1,250
  • 7
  • 26
  • 38