在Wordpress中创建/更新新帖子后更新/插入自定义表格

Is there any way to update a couple of mySQL tables when I create a new post or edit an existing post.

For example, I have a custom post type called 'television'. I have a custom table called tvoffers which stores offers for a particular television.

So, if I am writing a post on say Sony Bravia 32" LCD, I can also enter information in the TV offers such as :

offer_id   post_id  Offer_name   Offer_code    Offer_link   Price

?

Is this possible to do? Any help will be most appreciated.

You need to use a Wordpress hook. In this case, you should apply an action hook to the save_post action (or any other action hooks that you think would be a better match; lots of them exist):

add_action( 'save_post', 'update_database_with_info' );

function update_database_with_info( $post_id ) {
    // Now do something with the post
}

This code should be added to your functions.php file, located in your themes directory.

Note that an updated page also triggers save_post, so you might want to take this into account in your function.