Distinguish between publish and update? [duplicate]

<?php
add_action( 'save_post', 'your_action' );

function your_action( $post_id ) {

    if ( !wp_is_post_revision( $post_id ) ) {
        // Do this only if not a revision
    }
}
?>

Use the if condition to check if post is not revision.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)