Quote:
I have checked all the code again and but it is not updating database and also not showing any error
Because of the way you build your SQL request, its syntax depends on the contain of variables, thus making impossible to know the real request as seen on SQL server side. This problem is known as 'SQL Injection'.
I would:
$sql="UPDATE users SET firstname='$fname',lastname='$lname',email='$email' WHERE id='$id'";
echo "SQL request:".$sql;
Just to see what is the request.
Or better:
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[
^]
SQL Injection[
^]
SQL Injection Attacks by Example[
^]
PHP: SQL Injection - Manual[
^]
How can I explain SQL injection without technical jargon? - Information Security Stack Exchange[
^]