How to get row value from wpdb

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 … Read more

WPDB SQL query SELECT from category

If you are find products by specified category. Please find below code : $results = $wpdb->get_col( ” SELECT p.ID FROM {$wpdb->prefix}posts as p INNER JOIN {$wpdb->prefix}postmeta as pm ON p.ID = pm.post_id LEFT JOIN {$wpdb->prefix}term_relationships ON ({$wpdb->prefix}posts.ID = {$wpdb->prefix}term_relationships.object_id) WHERE p.post_type LIKE ‘product’ AND p.post_status LIKE ‘publish’ AND pm.meta_key LIKE ‘_stock_status’ AND pm.meta_value LIKE ‘instock’ … Read more

$wpbd->insert() does not insert user data

user_register action allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. So you wish to insert record for user when user register you can modify your code like follows: add_action( ‘user_register’, ‘nuevoPostulante’, 10, 1 ); function nuevoPostulante( … Read more

Prepare WPDB with meta key and meta value

If you run this query manually, you should get a response like (1054, “Unknown column ‘wp_postmeta.meta_key’ in ‘where clause’”) Long story short, wp_postmeta.meta_key is not a valid column of wp_posts. You need to JOIN the postmeta table to be able to use its columns. (There are many resources out there that explain JOIN, one would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)