View Full Version : When Updating a One-Row Table ?

04-30-2011, 12:24 PM

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

Like this:

$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 ?


04-30-2011, 01:08 PM
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.

04-30-2011, 01:08 PM
your sql works fine as it is if the table has one row.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum