Updating Row in SQLite Table

The address updates but the city does not.

		set newAddress to contents of text field "address" of box "buildinginformation" of window "vieweditbuilding"
		set updateAddress to "update buildings set address = '" & newAddress & "' where address = '" & buildingAddress & "'; "
		do shell script head & updateAddress & tail
		set newCity to contents of text field "city" of box "buildinginformation" of window "vieweditbuilding"
		set updateCity to "update buildings set city = '" & newCity & "' where address = '" & buildingAddress & "'; "
		do shell script head & updateCity & tail

I could set the update city line to

		set updateCity to "update buildings set city = '" & newCity & "' where city = '" & buildingCity & "'; "

But if I do this it will update all cities that match. I only want to update the city in a specific row. Does anyone have any idea’s on this one.

Well I think I figured out my problem but I will not be able to try my solution until I get home. The first set of code that I supplied should work. Prior to the set of code I’ve shown I get the building address from the database and assign it to the variable buildingAddress. In the first shell script I update the address in the database but I do not update the variable buildingAddress with the new changed address. So when I try to change the city it is looking for the old address and cannot find it. I’ll update this post later as to whether or not it worked.

Yep that was my problem, I need to watch my variables a little closer. But a new question has surfaced. Is there a way to put apostrophes in an sqlite database. I’ve been getting database errors when I try. I assume it is because the data I’m putting into the database is bracketed by apostrophes.