The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Checking The Time in DB Field.
Hello Everyone,
I have a database field which has a timestamp in it, named datalastupdate. I have an admin option, named helpcenter_auto_close which sets the period of time that has to pass. I have the following php code: PHP Code:
I cant see what i'm doing wrong, can anybody help me? Thanks, Paul. |
#2
|
|||
|
|||
Is your column in your database store UNIX time or date and time like in this format, year-month-day hour:minute:second?
Also you are overwriting the value of $hc_time1 here and $hc_time2 doesn't look to be set. PHP Code:
|
#3
|
|||
|
|||
To be honest i'm not sure what is used. When adding the timestamp to the database i've just used TIMENOW the same as I have used it above.
Just realised the error with the $hc_time and have sorted it thanks, but still not working. Thanks, Paul. Updated Code: PHP Code:
|
#4
|
|||
|
|||
Have you tried running the cron in your browser to see if any errors occur? Also if the time you are supplying isn't in UNIX time it wouldn't work.
Also does $vbulletin->options['helpcenter_auto_close'] contain a number above 0? |
#5
|
|||
|
|||
Does using TIMENOW when adding to the DB not store it in UNIX?
I have tried running it in the browser but I just get a blank white page, when I get home later today i'll put some print statements in to test how far it is getting It does hold a value above 0, ive set it to 120 to test it. Thanks, Paul. |
#6
|
||||
|
||||
TIMENOW is the UNIX-style timestamp. You really don't need to assign it to a variable.
|
#7
|
|||
|
|||
Ah right just when I was looking at other examples it has been assigned to a variable.
So could I use instead: $hc_timediff = intval(TIMENOW-$hc_time2); Thanks, Paul. |
#8
|
|||
|
|||
Throw in some var_dump()'s and echo()'s to check which is being executed it maybe that it isn't fetching stuff from the database. Blank pages are useless for debugging!
|
#9
|
|||
|
|||
What i dont understand is ive put a print statement at the very top and when I run the file it doesnt even print that line like it should.
Thanks, Paul. |
#10
|
|||
|
|||
Good code layout is essential I can easily say that more organised code will gaurantee that you can troubshoot problems faster. Please, please, please layout code properly!
Here is how I would have done it (I've commented in lines I would try, to solve problems e.t.c.): PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|