Search Posts

mysql query execute multiple time

i have mysqli query that insert to database but when i click trigger it, it insert twice,inserting a dumb data and the real data below is my code


 $usernme = ($_POST['testify']);



$queryNewPlege = "INSERT INTO posts (text, timeline_id, active, time) 
  VALUES ('$usernme', '$id', '$ac', '$ti')";


      $getLastInsertID = mysqli_insert_id($dbhandle);

      $upQuery = "UPDATE posts SET post_id =$getLastInsertID WHERE id=$getLastInsertID";
       mysqli_query($dbhandle, $upQuery);      





it work fine but insert twice,first a dumb data and secondly the real data,been looking at it for some time now but still could not fined the error, please any help would be appreciated.

Source: Stackoverflow

Leave a Reply

Your email address will not be published. Required fields are marked *