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.

 

 

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:

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.