I want to echo 'yes' if the "notification" row value is 1
I tried to do with this code:
global $wpdb;
$row =$wpdb->get_results("SELECT * FROM wp_users");
if($row['notification'] == 1){
echo 'yes';
}
As @nmr says, $row is an array of objects. You'll need to foreach these - and do the check in the foreach like this:
foreach ($row as $item) {
if($item->notification == '1') {
echo 'Yes';
}
}
And there's no "notification" column as far as I know.
Also, can you explain what you're trying to achieve? Maybe there's an easier way to achieve your goal.
Best regards
$row
is array of objects. To get for example login field from first result you should use$login = $row[0]->user_login;
. Look here,get_results()
returns array of objects or array of arrays. And the second thing, in users table there is no columnnotification
.