mysql_query("UPDATE member_info SET tel = '33333339' WHERE id = '3'");
This above sql statement with php that can be update in database table.

But when I change id to be a variable. That cannot update to database
But I echo $update_id; $update_id can show be 3
mysql_query("UPDATE member_info SET tel = '33333339' WHERE id = '".$update_id."'");

I want to to what's wrong about my statement?

get rid of the concatenation...

mysql_query("UPDATE member_info SET tel='33333339' where id='$update_id';");

You can do inline variables, as long as you are using " " instead of ' '.

In your particular case, however, it looks like you have double quotes twice at the end of your statement, which basically ruins the string as a whole.

I would encourage you, though, to chage it further and do:

$my_string = "UPDATE member_info SET tel='33333339' where id='$udpate_id';");
$my_string = mysql_real_escape_string($my_string);
mysql_query($my_string)
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.