One question about saving objets
-
I have to save a single parameter of my objects.
What is the best to do with buddypress ?
Initially, I did
$sql = $wpdb->prepare( "UPDATE {$bp->classifieds->table} SET status='published' WHERE id='%d'", $classified_id );
if ($wpdb->query($sql) ) return true;But is it or not better to do this
$classified_obj->status = 'published';
if ($classified_obj->save()) return true;It seems cleaner but I guess then it update all the object’s fields… And that the first example updates just one field !
What is preferable ?
Thanks
- The topic ‘One question about saving objets’ is closed to new replies.