Jump to content

Please Help Me


skwap

Recommended Posts

Friends,

 

iam developing a small website & i used php & mysql.

 

i have a problem small problem with sql update statement.....

 

HERE IS MY DATA BASE TABLE

 

id    pubtoday    pubtotal    todayclicks    totalclicks    today_is

1      2.00              5.00          200                5000          29/2011/07

 

 

 

I want to update all user's pubtoday & todayclicks fields as 0 if the today_is date is not match with today date & also update new date.

Consider Above Code (I Used)

 

$today = date("d/Y/m");

$update = mysql_query("UPDATE `statistics` SET `pubtoday` = '0.00' , `todayclicks` = '0' WHERE `today_is`!=$today");

if($update) {

$update1 = mysql_query("UPDATE `statistics` SET `today_is` = '$today' WHERE `today_is`<>$today");

}

 

but here iam facing a problem that is pubtoday & todayclicks is setting as 0 if the date match. I need only update if the $today date is not match with db stored date.

 

 

Please help me... & what is the error ??

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/243242-please-help-me/
Share on other sites

i changed the today_is data type to date & also made a small changes in the code (added quotes surrounded by $today)...

 

Ya Its Got Worked !

 

Thank You...........................

 

Could you please explain what may be the error occurred their ??

is it the problem of data type / in coding ?

Link to comment
https://forums.phpfreaks.com/topic/243242-please-help-me/#findComment-1249272
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.