Go Back   Pro/Forums > ProCooling Geek Bits > Random Nonsense / Geek Stuff
Password
Register FAQ Members List Calendar Chat

Random Nonsense / Geek Stuff All those random tech ramblings you can't fit anywhere else!

Reply
Thread Tools
Unread 08-21-2003, 03:06 PM   #1
Joe
The Pro/Life Support System
 
Joe's Avatar
 
Join Date: Dec 1999
Location: Denver, CO
Posts: 4,041
Default 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 - I only take this hat off for one thing...

ProCooling archive curator and dusty skeleton.
Joe is offline   Reply With Quote
Unread 08-21-2003, 05:05 PM   #2
Joe
The Pro/Life Support System
 
Joe's Avatar
 
Join Date: Dec 1999
Location: Denver, CO
Posts: 4,041
Default

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)
__________________
Joe - I only take this hat off for one thing...

ProCooling archive curator and dusty skeleton.
Joe is offline   Reply With Quote
Reply


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

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
Forum Jump


All times are GMT -5. The time now is 02:47 AM.


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