View Full Version : nesting SET calls

fritz Jung
07-24-2002, 01:58 PM
Seems like I am wasting processing power with this...

$sql="UPDATE traffic SET hits=hits+1 Where (record_no='0001')";
$sql="UPDATE traffic SET hits_mtd=hits_mtd+1 Where (record_no='0001')";

Am having trouble nesting this.... I've tried

$sql="UPDATE traffic SET hits=hits+1, SET hits_mtd=hits_mtd+1 Where (record_no='0001')";


$sql="UPDATE traffic SET hits=hits+1, hits_mtd=hits_mtd+1 Where (record_no='0001')";

But those have no effect ...

How can I nest a bunch of SET statements in a single SQL call?

07-25-2002, 03:37 AM
I can see no reason that

$sql="UPDATE traffic SET hits=hits+1,hits_mtd=hits_mtd+1,another_field=another_field+2 Where record_no='0001'";

would not work, (assuming record_no is a string and not an integer in which case drop the `'`s)