Nguyên tắc sử dụng đầu tiên phải gọi biết global $wpdb, sau đây là những phương thức hay dùng
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  | 
						global $wpdb; $table=$wpdb->prefix."bookit_services"; $data = array(     'category_id' => $bookit_category_id,      'title' => $service_name,     'duration' => 5400,     'price' => '0.00' ); $format = array(     '%d',     '%s',     '%d',     '%s' ); $wpdb->insert($table,$data,$format); $bookit_service_id = $wpdb->insert_id;  | 
					
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | 
						$table = $wpdb->prefix."chilitheme_comments"; $data = array(     'content' => $comment_content,      'status' => $comment_status,     'rating' => $comment_rating ); $where = array(     'id' => $comment_id ); $updated = $wpdb->update( $table, $data, $where ); if ( false === $updated ) {     // There was an error. } else {     // No error. You can check updated to see how many rows were changed. }  | 
					
| 
					 1 2 3 4  | 
						$answers=$wpdb->get_results("SELECT * FROM `".$wpdb->prefix."chilitheme_comments` where `parent` = '{$check_parent->id}'"); if($answers): foreach($answers as $answer):    //command is here endforeach; endif;  | 
					
| 
					 1  | 
						$current_comment = $wpdb->get_row("SELECT * FROM `".$wpdb->prefix."chilitheme_comments` where `id` = '{$comment_id}'");  | 
					
Mọi sự sao chép xin ghi rõ nguồn là fcwordpress.net
Chuyên trang về wordpress: hướng dẫn thiết kế theme, plugin, thủ thuật wordpress
Chili Comment. Giấy phép không hợp lệ. Kích hoạt tại đây