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 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,680
    Thanks
    28
    Thanked 4 Times in 4 Posts

    When Updating a One-Row Table ?

    Hi,

    I have a table which contains just one row, and is updated each day.

    Like this:

    PHP Code:
    $sql "UPDATE pdc_promo_count SET cntr = '$new_cntr'"//  only one row    
    mysql_query($sql)or die("could not UPDATE pdc_promo_count"mysql_error()); 
    As you can see, I don't have a WHERE clause.

    Do I need one when there is only one row ?



    .
    Last edited by jeddi; 04-30-2011 at 12:34 PM.
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    Regular Coder
    Join Date
    Apr 2011
    Posts
    286
    Thanks
    2
    Thanked 39 Times in 39 Posts
    If it is one row, you can get away without a WHERE clause.

    As for performance concerns, not sure, would have to benchmark it, though I would assume it would be very small/negligible difference.

  • #3
    Regular Coder
    Join Date
    Mar 2011
    Posts
    148
    Thanks
    0
    Thanked 20 Times in 20 Posts
    Hy,
    your sql works fine as it is if the table has one row.


  •  

    Posting Permissions

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