Pro/Forums

Pro/Forums (http://forums.procooling.com/vbb/index.php)
-   Random Nonsense / Geek Stuff (http://forums.procooling.com/vbb/forumdisplay.php?f=15)
-   -   I need some SQL/PHP/vB Help!!! Programmers! (http://forums.procooling.com/vbb/showthread.php?t=7701)

Joe 08-21-2003 03:06 PM

I need some SQL/PHP/vB Help!!! Programmers!
 
Ok on the new sites I am building, they are based on vB3 Beta5 ( Vbulletin 3).

One of the scripts I am writing and wrote originally for vB2 no longer work. Its a Calendar script to show the next 3 public events on a non vB page.

Heres the section of code that is causing me issues:

Code:

$events = $DB_site->query("SELECT FROM_UNIXTIME(dateline_from,'%Y-%m-%d') AS dateline_from, eventid, title
                          FROM event
                          WHERE calendarid = 1 AND dateline_from >= ".vbdate('Y-m-d',time())."
                          ORDER BY dateline_from LIMIT 3");

now wiht the rest of the code in the script the resulting code from the "dateline_from" variable and the ".vbdate('Y-m-d',time())." function are both YYYY-MM-DD.

But theres no cut off for the date. the issue is that it shows events that already happened. The kicker in all this is tha tin vb3 they changed the date format for the calendar dates to Unix Time stamps, instead of clear YYYYMMDD, so I need to runthe "from_unixtimestamp" in the query to get it to a format that vbdate can compare against.


The big thing that I THINK would make this work is if I can find what I need to do to replace that vbdate entry with the current Unix timestamp. If I got that then I could remove the whole unix timestamp from teh query and do the >= comparison with 2 flat simple unix times.

I am absolutely NOT a programmer, and thats why this is sorta getting me upset :)

edit: incase it isnt clear this is the line thats a problem:
Code:

WHERE calendarid = 1 AND dateline_from >= ".vbdate('Y-m-d',time())."
it should make it so no calendar item older than the date the script is run will be shown. (vbdate = todays date)

And it isnt working. if I change the expression to just = I get nothing, if I change it to <= I get nothing, but at >= I get everything...

If someone could give me the code to replace the whole vbdate function with another function for a current date in unix timestamp format, thats all I need :)

Joe 08-21-2003 05:05 PM

NM ! I fixed it.

The revised code is as such:
Code:

$events = $DB_site->query ("SELECT UNIX_TIMESTAMP() AS dateline, dateline_from, eventid, title
                          FROM event
                          WHERE dateline_from > dateline
                          ORDER BY dateline_from LIMIT 4");

Doh, but now it works great and with all unix time code (so I can manipulate it later in the script to the formats I want)


All times are GMT -5. The time now is 10:29 PM.

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
(C) 2005 ProCooling.com
If we in some way offend you, insult you or your people, screw your mom, beat up your dad, or poop on your porch... we're sorry... we were probably really drunk...
Oh and dont steal our content bitches! Don't give us a reason to pee in your open car window this summer...