Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-30-2011, 12:24 PM   PM User | #1
jeddi
Senior Coder

 
Join Date: May 2006
Posts: 1,544
Thanks: 26
Thanked 4 Times in 4 Posts
jeddi has a little shameless behaviour in the past
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 ?



.
__________________
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.

Last edited by jeddi; 04-30-2011 at 12:34 PM..
jeddi is offline   Reply With Quote
Old 04-30-2011, 01:08 PM   PM User | #2
Wojjie
Regular Coder

 
Join Date: Apr 2011
Posts: 286
Thanks: 2
Thanked 39 Times in 39 Posts
Wojjie is on a distinguished road
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.
Wojjie is offline   Reply With Quote
Old 04-30-2011, 01:08 PM   PM User | #3
MarPlo
Regular Coder

 
Join Date: Mar 2011
Posts: 145
Thanks: 0
Thanked 20 Times in 20 Posts
MarPlo is an unknown quantity at this point
Hy,
your sql works fine as it is if the table has one row.
__________________
MarPlo is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:49 AM.


Advertisement
Log in to turn off these ads.