Jump to content

Recommended Posts

Hey guys,

 

I have a bit of a dilemma and I don't know what I'm doing wrong.

 

Basically, I have this query:

INSERT INTO weeklydownloads (app_id, week, weekdownloads, lastdl) VALUES ('{$this->app_id}', '{$this->week}', 1, NOW())

The query itself works just fine, however, it doesn't add the current time and date to the "lastdl" field. What this query does is actually increment a download counter for each element, for that current week of the year. The lastdl field is there only to record when was the last download made.

 

So, what am I doing wrong here? :)

Link to comment
https://forums.phpfreaks.com/topic/280540-strange-query-results/
Share on other sites

actually your query should work as it is, its strange that its not working, you can try assigning "CURRENT_TIMESTAMP" as default value for "lastdl" field and remove it from INSERT query

 

so your query will be 

INSERT INTO weeklydownloads (app_id, week, weekdownloads) VALUES ('{$this->app_id}', '{$this->week}', 1)

may this work for you

it doesn't add the current time and date to the "lastdl" field

 

 

what value does it put into the field and how are you seeing what the incorrect value is in the field?

 

some possibilities, you have another query that replaces the value after the fact with something else or if the observed symptom is due to some output from your code, you could have a logical error that is causing the wrong value to be displayed.

 

shorter-answer: the insert query you have posted ISN'T the problem (assuming that's your actual query statement.) something else is occurring that is causing the symptom you are stating.

Edited by mac_gyver
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.