Helpful Information
Home
Categories
Contact us
Category: MySQL
nesting SET calls
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')";
and
$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?
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)
privacy (GDPR)