Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 15 May 2017, 07:40
tinuz tinuz is offline
 
Join Date: Apr 2016
PHP Date() returning default value

Hey guys. I'm currently working on a new mod for vBulletin 4.x

In short it's a new panel that allows teammembers to monitor for new posts on the forum through Ajax, like the mod over here: http://www.vbulletin.org/forum/showthread.php?t=125947, but instead of working like a RSS feed, it only shows posts that haven't been checked by a teammember. Once a teammember opened the post or new thread, it disappears from the list.

Anyway, right now I'm working on a small part that keeps track of how many posts were checked by each teammember every single day. For that I'm editing the file:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

After the query inside the if-statement on line 168:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I've written the following:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The code is working perfectly fine, but


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

is returning me 0000-00-00 instead of the current date as I would expect. I know I could use the constant TIMENOW defined in vBulletin, but that one returns a UNIX timestamp, instead of a normal date.

So could anyone tell me why this is happening? Could be a local scope problem?

--------------- Added 15 May 2017 at 08:07 ---------------

I've fixed the issue by using CURDATE() inside my queries instead of relying on PHP to do it. Still, if anyone could tell me why it didn't work, that would be perfect

--------------- Added 15 May 2017 at 13:46 ---------------

It turns out the variable was returning the correct date as expected. I should've wrapped the variable inside quotes in the queries: AND mydate = '$modP_today'
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 23:18.

Layout Options | Width: Wide Color: