After I use var_dump($rows);
I get result from query as below:
object(stdClass)#11 (2) {
["id"]=>
string(1) "1"
["name"]=>
string(5) "riski"
}
but the result gives error
Notice: Array to string conversion
in this line :
foreach($rows as $val){
$user .= '<option value="'.trim(addslashes($val->id)).'">'.trim(addslashes($val->name)).'</option>';
}
How to convert the result to foreach
result?