<?php
session_start();
if(isset($_SESSION['Suserid']))
{
if(isset($_POST['submit']))
{
$dbconnect=mysqli_connect('localhost','root','','mismatch')
or die('Error connecting to database');
$firstname=mysqli_real_escape_string($dbconnect,trim($_POST['firstname']));
$lastname=mysqli_real_escape_string($dbconnect,trim($_POST['lastname']));
$gender=mysqli_real_escape_string($dbconnect,trim($_POST['gender']));
$birthday=mysqli_real_escape_string($dbconnect,trim($_POST['birthday']));
$city=mysqli_real_escape_string($dbconnect,trim($_POST['city']));
$state=mysqli_real_escape_string($dbconnect,trim($_POST['state']));
$query="edit logindetail set 'firstname'=$firstname, set 'lastname'=$lastname', set 'gender'=$gender, set 'birthday'=$birthday,set 'city'=$city, set 'state'=$state WHERE id ='$_SESSION[Suserid]'";
mysqli_query($dbconnect,$query);
echo'Successfully edited your profile<br/>';
echo'<a href="view.php">View my profile</a><br/>';
echo'<a href="edit.php">Edit profile</a><br/>';
echo'<a href="logout.php">Logout['.$_SESSION['Susername'] .']</a>';
mysqli_close($dbconnect);
}
session is keeping the track of id from the database so ,,is my query correct to edit data into the database am checking if the id in database is equal to the session ids since session id is tracking the value of id so am i allowed to do that or not ,,the code is running but not making the change in database..please help


You also only have to use the word 'SET' once in your update query. In addition to that, on your individual assignments in the sql string, you don't want to quote the field names, because that turns them into literal strings, but you DO want to put quotes around the string values and numeric values do not need to be quoted. so this line: