Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
03-12-2014, 01:46 PM #1
- Join Date
- Oct 2009
- Thanked 3 Times in 3 Posts
updating field when `field1`+`field2` = 'string'
How do I update a counter field if field1 + a space + field2 equals $string.
UPDATE `counters` SET `counter1` = `counter1` + 1 WHERE `field1`.' '.`field2`` = '$string' LIMIT 1
03-17-2014, 06:38 PM #2
- Join Date
- Jan 2011
- Thanked 760 Times in 758 Posts
I think I'd split the string into the field names and use
UPDATE `counters` SET `counter1` = "counter1" + 1 WHERE `field1` = "first part of string" AND `field2`` = "Next part of string" LIMIT 1Evolution - The non-random survival of random variants.
Because I love FLEXBOX and tired of waiting: http://davidwalsh.name/goodbye-vendor-prefixes
03-18-2014, 02:16 PM #3
i think concat would work
UPDATE `counters` SET `counter1` = `counter1` + 1 WHERE CONCAT ( field1, field2 ) = '$string' LIMIT 1
Last edited by Arcticwarrio; 03-18-2014 at 02:18 PM.There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Get Cloud Hosting now from only£59 / month