A new row is inserting whenever write to data store is happening.

Certified Senior Developer

Hi,

After every user input task completed i have called write to data store entity to insert data to table so over all in main process i have called three times so after every user input task a new row creating the values is not getting updated but after every user interaction a new row is getting inserted. i have updated the details correctly like below in input and also in output tab i stored the ac values to cdt. kindly suggest me on this and autoincrement i have given to Id column in cdt

Query:

  Discussion posts and replies are publicly visible

Parents
  • Header the user to a new page :

    if (isset($_POST['submit']))
    {
    $user= $_POST['username'];
    $email = $_POST['useremail'];
    $pass= $_POST['password'];
    
    mysql_query("INSERT INTO table (username, useremail, email) VALUES(`$username','$useremail','$email')");
    
    }
    //best outside the if statement so user isn't stuck on a white blank page.
    header("location: landing_page.php");
    exit;

    By doing this the user who refreshes will be refreshing landing_page.php which means it won't do the insert twice.

    Best advice: do a check to see if user exists first if so don't insert!

Reply
  • Header the user to a new page :

    if (isset($_POST['submit']))
    {
    $user= $_POST['username'];
    $email = $_POST['useremail'];
    $pass= $_POST['password'];
    
    mysql_query("INSERT INTO table (username, useremail, email) VALUES(`$username','$useremail','$email')");
    
    }
    //best outside the if statement so user isn't stuck on a white blank page.
    header("location: landing_page.php");
    exit;

    By doing this the user who refreshes will be refreshing landing_page.php which means it won't do the insert twice.

    Best advice: do a check to see if user exists first if so don't insert!

Children