update( 'school', //table array('city' => $city), //data array('name' => $name), //data array( 'ID' => $id ), //where array('%s'), //data format array('%s'), //data format array('%s') //where format ); } //delete else if(isset($_POST['delete'])){ $wpdb->query($wpdb->prepare("DELETE FROM school WHERE id = %s",$id)); } else{//selecting value to update echo "
"; var_dump ($schools); echo ""; $schools = $wpdb->get_results($wpdb->prepare("SELECT id,name,city from school where id=%s",$id)); foreach ($schools as $s){ // display existing value in the field $name=$s->name; $city=$s->city; } echo "
"; var_dump ($schools); echo ""; } ?>
School deleted
School updated