Welcome Guest, Not a member yet? Register   Sign In
SQL: SET column1+=value
#3

[eluser]vitoco[/eluser]
You can't use "field += 1", but you can "field = ( field + 1 )" , so your query will be

Code:
$sql = "
UPDATE
    Review
SET
    numHelpful = ( numHelpful  + ".$numHelpful." ),
    numNotHelpful = ( numNotHelpful + ".$numNotHelpful." )
WHERE
    reviewID =".$reviewID;

the () are also optional, but in my opinion the query gets more readable.

Slds


Messages In This Thread
SQL: SET column1+=value - by El Forum - 01-03-2013, 12:24 AM
SQL: SET column1+=value - by El Forum - 01-03-2013, 01:13 AM
SQL: SET column1+=value - by El Forum - 01-03-2013, 01:41 AM
SQL: SET column1+=value - by El Forum - 01-03-2013, 02:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB