Jump to content

Need Prevent Inserting Duplicate Record in Datbase when Refresh form


Faks

Recommended Posts

Looking at your video it would appear you are using mysql as on one of your tabs you have php myadmin open so I'm assuming you need ]#

http://www.tutorialspoint.com/mysql/mysql-handling-duplicates.htm

 

INSERT IGNORE INTO tbl_name (column1, column2) VALUES( 'val1', 'val2');

 

if the same items are then submitted for a second time the insert will not happen.

 

I'm not a pro at mysql and these were actually suggested to me in another thread. but it did work for me.

 

If you have trouble re-wrritting your actual insert query to use the insert ignore post it here and i'll help if I can.

 

 

Link to comment
Share on other sites

Hi everybody i got code chuck of token  but the main problem is it's not working i would really happy to fix it up .

if(isset($_POST['token']) && $_POST['token'] == $_SESSION['token']){
            
        //Add Comment
        
        unset($_SESSION['token']);
}

$new_token = md5(time() . rand(0,100));
$_SESSION['token'] = $new_token;

?>

<form method="post" action="">
        <!--lauki šeit-->
        
        <input type="hidden" name="token" value="<?=$new_token;?>"/> 
</form>

:wtf::confused:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.