Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

MYSQL simple update statement

what is wrong with my sql statement?
I use php and mysql
$id is an integer

$sql3 = "UPDATE urunler SET tavsiye='$tavsiye' WHERE id='$id'";

$result3 = $conn->query($sql3);
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

You do not need the single quotes, that will change the variables into a string. Variables inside a double quote will parse into their value.

$sql3 = "UPDATE urunler SET tavsiye= $tavsiye WHERE id= $id";

$result3 = $conn->query($sql3);

Open in new window

SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial