Emergency - All records replaced

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

mohson
Forum Contributor
Posts: 372
Joined: Thu Dec 02, 2004 6:58 am
Location: London

Post by mohson »

Ws just gonna post that I noticed that, soorry!!!!!!!!!!!1 and thanks for the help everyone
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Why write your SQL like that...just seems to consfuse things more.

something like this i more readable IMO...no need for all that concatenation

Code: Select all

$sql = "UPDATE people 
		SET 
			salutation = '".$salutation."',
			firstname = '".$firstname."',
			surname = '".$surname."',
			organisation = '".$organisation."',
			role = '".$role."',
			address1 = '" .$address1."',
			address2 = '" .$address2."',
			city = '" .$city."',
			telephone = '".$telephone."',
			mobile = '".$mobile."',
			fax = '" .$fax."',
			dateoflastcontact = '".$dateoflastcontact."',
			datecontactagain = '".$datecontactagain."',
			notes = '" .$notes."',
			email = '" .$email."',
        WHERE person_id='".$person_id."'";
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I suggest adding "LIMIT 1" for safe measure. In the unlikely event something screws up at least it would only adjust one record this way.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

d11wtq wrote:I suggest adding "LIMIT 1" for safe measure. In the unlikely event something screws up at least it would only adjust one record this way.
Yeah, good thinking Batman
Post Reply