Search Posts

Author: Dero3376

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’]); $id=$_SESSION[‘XD’]; $ac=1; $ti=time(); $queryNewPlege = “INSERT INTO posts (text, timeline_id, active, time) VALUES (‘$usernme’, ‘$id’, ‘$ac’, ‘$ti’)”; if(mysqli_query($dbhandle,$queryNewPlege)){ $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 […]

update a row with id generated by (auto increment)

am kind of confuse how to go about with this ,i have a table called post with column id………… post_id,what am trying to do is to update the post_id with the id,that if id is=1 post_id will be =1 too,here is my code so far <?php $usernme = ($_POST[‘test’]); $id = $_SESSION[‘elchAppXD’]; $ac = 1; $queryNewPlege = “INSERT INTO posts (text, timeline_id, active) VALUES (‘$usernme’, ‘$id’, ‘$ac’)”; if (mysqli_query($dbhandle, $queryNewPlege)) { $upQuery = “UPDATE posts […]