Hi everyone,
I'm trying to write some PHP code to update a user's password. It is not updating and I can't spot what's wrong with my query (I have echo'ed it to the screen).

$sql="UPDATE $tbl_name set 'password'='$new_password' WHERE 'user'=$user;";
			$result=mysql_query($sql);

SQL statement

UPDATE user set 'password'='2' WHERE 'user'=test;

What's wrong?

you are doing it in reverse order, following is the correct version

$sql="UPDATE $tbl_name set password='$new_password' WHERE user='$user'";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.