public function save()
    {
        global $wpdb;
        $isExists = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*)
				FROM ' . $wpdb->prefix . 'comments
				WHERE comment_ID = %d', $this->comment_ID));
        $c = 'comment_';
        if ($isExists) { // update
            return $wpdb->query(
                $wpdb->prepare(
                    "UPDATE ' . $wpdb->prefix . 'comments
					SET {$c}post_ID = %d, {$c}author = %s,
						{$c}author_email = %s, {$c}author_url = %s,
						{$c}author_IP = %s, {$c}date = %s,
						{$c}date_gmt = %s, {$c}content = %s,
						{$c}karma = %s, {$c}approved = %s,
						{$c}agent = %s, {$c}type = %s,
						{$c}parent = %s, user_id = %s
					WHERE comment_ID = %d", $this->comment_post_ID, $this->comment_author, $this->comment_author_email, $this->comment_author_url,
                    $this->comment_author_IP, $this->comment_date, $this->comment_date_gmt, $this->comment_content, $this->comment_karma,
                    $this->comment_approved, $this->comment_agent, $this->comment_type, $this->comment_parent, $this->user_id,
                    $this->comment_ID));
        }
    }
public function save()
    {
        global $wpdb;
        $isExists = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*)
				FROM ' . $wpdb->prefix . 'comments
				WHERE comment_ID = %d', $this->comment_ID));
        $c = 'comment_';
        if ($isExists) { // update
            return $wpdb->query(
                $wpdb->prepare(
                    "UPDATE ' . $wpdb->prefix . 'comments
					SET {$c}post_ID = %d, {$c}author = %s,
						{$c}author_email = %s, {$c}author_url = %s,
						{$c}author_IP = %s, {$c}date = %s,
						{$c}date_gmt = %s, {$c}content = %s,
						{$c}karma = %s, {$c}approved = %s,
						{$c}agent = %s, {$c}type = %s,
						{$c}parent = %s, user_id = %s
					WHERE comment_ID = %d", $this->comment_post_ID, $this->comment_author, $this->comment_author_email, $this->comment_author_url,
                    $this->comment_author_IP, $this->comment_date, $this->comment_date_gmt, $this->comment_content, $this->comment_karma,
                    $this->comment_approved, $this->comment_agent, $this->comment_type, $this->comment_parent, $this->user_id,
                    $this->comment_ID));
        }
    }
public function save ( ) { global $ wpdb ; $ isExists = $ wpdb -> get_var ( $ wpdb -> prepare ( 'SELECT COUNT(*)
				FROM ' . $ wpdb -> prefix . 'comments
				WHERE comment_ID = %d' , $ this -> comment_ID ) ) ; $ c = 'comment_' ; if ( $ isExists ) { // update return $ wpdb -> query ( $ wpdb -> prepare ( "UPDATE ' . $wpdb->prefix . 'comments
					SET {$c}post_ID = %d, {$c}author = %s,
						{$c}author_email = %s, {$c}author_url = %s,
						{$c}author_IP = %s, {$c}date = %s,
						{$c}date_gmt = %s, {$c}content = %s,
						{$c}karma = %s, {$c}approved = %s,
						{$c}agent = %s, {$c}type = %s,
						{$c}parent = %s, user_id = %s
					WHERE comment_ID = %d" , $ this -> comment_post_ID , $ this -> comment_author , $ this -> comment_author_email , $ this -> comment_author_url , $ this -> comment_author_IP , $ this -> comment_date , $ this -> comment_date_gmt , $ this -> comment_content , $ this -> comment_karma , $ this -> comment_approved , $ this -> comment_agent , $ this -> comment_type , $ this -> comment_parent , $ this -> user_id , $ this -> comment_ID ) ) ; } }
Save or Update the comment
Save or Update the comment