Cannot enter something in Database MYSQL PHP -


i'm trying put information automatically in database works first time. if reload page doesn't put in again.

this code:

<?php require '../overig/connect.php'; require '../overig/secure.php';  $userr = $_session['email']; $user = md5($userr);  $friend2 = $_server['request_uri']; $friend = substr($friend2, 6, 25); $q = 1; $a = 0; if((isset($user)) || isset($friend)) {     $add = "insert `friends` (p1,p2,q,a) values ('$user','$friend','$q','$a')";     $result = mysqli_query($con, $add); } else {   echo 'hello'; } ?> 

i hope can me :)

lets convert this:

"insert friends (p1,p2,q,a) values ('$user','$friend','$q','$a')";"

into generated sql , this:

insert friends (p1,p2,q,a) values ('john','jim','this','that'); 

what happen if tried run twice? suspect see 1 row this:

|john|jim |this|that| 

but expecting:

|john|jim |this|that|     |john|jim |this|that| 

to achieve consider changing database , scripts result more this:

|1   |john|jim |this|that|     |2   |john|jim |this|that| 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -