Only update not insert again if email is exit

i want that only insert first time and next time when i changed some thing only update do not insert again

<?php session_start(); include_once('../dbconnect.php'); if(!isset($_SESSION['user'])) { header("Location: ../index.php"); } $email=$_SESSION['user']; $res=mysql_query("SELECT * FROM user_businessleads WHERE user_email='$email'"); $row=mysql_fetch_array($res); if(isset($_POST['submit'])) { $looking_for = $_POST['looking_for']; $services = $_POST['services']; $mybudget = $_POST['mybudget']; $around = $_POST['around']; $s_reguirement = $_POST['s_reguirement']; $chk=""; $email=$_SESSION['user']; foreach($services as $chk1) { $chk .= $chk1.","; } $query=mysql_query("INSERT INTO user_businessleads(services,user_email,looking_for,mybudget,around,s_requirment)values('$chk','$email','$looking_for','$mybudget','$around','$s_reguirement')"); } if(isset($_POST['submit'])) { $looking_for = $_POST['looking_for']; $services = $_POST['services']; $mybudget = $_POST['mybudget']; $around = $_POST['around']; $s_reguirement = $_POST['s_reguirement']; $chk=""; $email=$_SESSION['user']; foreach($services as $chk1) { $chk .= $chk1.","; } $updated=mysql_query("UPDATE user_businessleads SET services='$chk',looking_for=' $looking_for',mybudget='$mybudget',around='$around',s_requirment='$s_reguirement' WHERE user_email='$email'")or die; } ?>

in this code i got problem when i want update email it will be insert again an other row updated
i want that only insert first time next time only updated

You update something in your database like this:

$query->prepare('UPDATE tableName SET keyName = ?');

not working this query
can u changed in my code


Do not set value directly like this.

$pdo = new PDO('mysql:dbname=/*The name of your database*/;host=/*the host name*/, /*username between quotes*/, /*password between quotes*/);
$query = $pdo->prepare('UPDATE user_businessleads SET services=?, looking_for=?, mybudget=?, around=?,s_requirment=? WHERE user_email');
$query->execute($chk, $looking_for, $mybudget, $around, $s_reguirement);

in my code value is insert through session
in same session i want update read my whole code .
my problem is that …
only insert once do not again
in my code row is updated but inserted again in new row