Check for success of $wpdb->update() correctly

The correct way is with === FALSE which differentiates from equalling zero, which is what a succesful query with no results returns.

if( $wpdb->update($tableName,array('opt_value'=>$cInfo),array('opt_name'=>'showWeatherWidget')) === FALSE)
    //show failure message
else
    // show success message

Leave a Comment

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