mysql - PHP UPDATE DATABASE error -
i have problem code. have update, doesn't update db, , don't know why.. can me? please?
$query = "update company set name, address, latitude, longitude, about, cui, time, date, phone name=$name, address=$address, latitude=$latitude, longitude=$longitude, about=$about, cui=$cui, time=$time, date=$date, phone=$phone"; $result = mysql_query($query);
this not correct syntax of update.
correct structure of update statement is:
update [table_name] set field_one = '$field_one', field_two = '$field_two' field_name = '$field_value'
also, need add single quotes field values not int
defined in database.
updated query:
$query = "update company set name = '$name', address='$address', latitude='$latitude', longitude='$longitude', about='$about', cui='$cui', time='$time', date='$date', phone='$phone' [add_your_condition] ";
note: don't use mysql_ functions. deprecated ones , removed in new php versions. use pdo or mysqli_ instead.
Comments
Post a Comment