i want the sql executed is UPDATE address SET xx=xx WHERE id=$id AND userId=$userId, but actually executed is UPDATE address SET xx=xx, userId=$userId WHERE id=$id...
and i don't know how to pass the where condition to the update or save method...
The "where" condition is automatically determined by Phalcon, based on the primary key of the Address table. If you want userID to be included in the WHERE clause, you need to make it part of the primary key.
If you don't/cant do that, you'll have to resort to PHQL and building the query yourself.
It seems that this question is similar to mine, so I will post it here.
I have this function that doesn't work. It doesn't return any error, but it doesn't updates the record in database. Is there something wrong with phalcon update? I've tried also with other functions and it didn't work either.
public static function updateResponse($response,$sugester,$sugested,$location_id)
$sql = "UPDATE Sugestion SET response=$response WHERE sugester=$sugester AND sugested=$sugested AND location_id=$location_id;";
$sugestion = new Sugestion();
return new Resultset(null, $sugestion, $sugestion->getReadConnection()->query($sql));
It's just making an update in a record. What ever I do, it just doesn't update. Thank you so much!