Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple SET calls (clarified - I hope)

    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?
    Last edited by fritz Jung; 07-24-2002 at 04:16 PM.
    Fritz Jung
    co-founder
    the Witches' Voice
    www.witchvox.com

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,096
    Thanks
    11
    Thanked 101 Times in 99 Posts
    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)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •