I have for example an objec room which has an atribute floor which is text.
Let's say that $room->floor = "hi i'm a floor"

my querry statement would be
"UPDATE room SET floor=$room->floor where id=room->id"

when I insert it with php into a mysql db it gives an error because the '. How can i prevent this?

"UPDATE room SET floor=$room->floor where id=room->$id"

try this and post your code complitely

Escape the values in the query using your databases's escape function. If you use mysqli the function is mysqli_real_escape_string (or mysqli::real_escape_string if you do it OOP way).

$query = "UPDATE room SET floor='" . mysql_real_escape_string($room->floor) . "' where id=room->id";

thank you broj1, it works

You are welcome. Please mark as solved. Happy coding.