Tag Archives: silly life savers!

UPDATEs without a WHERE?!

It’s quite common that programmers (non-framework) write UPDATEs without WHERE clause and cause unexpected problems. This perhaps can make their job inconsistent as well and not just the database 😀

Well if you’re a programmer follow some simple techniques to save your job and database. If you forget to write the WHERE clause the query would fail leaving the data safe.

$sql = “UPDATE “.
” SET x = ‘y’, z = ‘a’ WHERE”.
“somekey = ‘someval'”;