$wpdb->insert,update,and delete method

Insert method

$wpdb->insert(tablename,array(values))

Update method

$wpdb->update(tablename,array(values),array(conditions))

Delete method

$wpdb->delete(tablename,array(conditions));

insert和update方法不需要用prepare方法,

wpdb的元查询(raw query) 就要用到prepare方法,而insert和update方法就不需要

raw query 形式: $wpdb->query($wpdb->prepare(“SELECT * FROM wp_users where ID = 1”));

Share :