This is what I'm trying to accomplish: If I'm adding or editing post I want to run a function that puts post_id, all the custom field values and category ids to some other db table I've created. I just want to know how to execute this function and how to get the values.
Put the following in your functions.php
file of your theme. It will run on both save as well as well update. Since you have the post ID, you can do whatever you want.
function do_my_stuff($post_ID) {
//do my stuff here;
return $post_ID;
}
add_action('save_post', 'do_my_stuff');