Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 05:34 am EST
Geeklog Forums
SQL Help... for GL 1.2.5
Anonymous
dreamscape
I'm maintaining a site for my school... on one of the pages I created (to list events), I've got this working:
$result = dbquery("SELECT eid,title,datestart,dateend FROM events ORDER BY datestart");
I need to change it so it only shows a list of events that are in progress or starting in the future... but this DOESN'T work:
$result = dbquery("SELECT eid,title,datestart,dateend FROM events WHERE datestart > date() ORDER BY datestart");
Can someone help me fix this query?
Thanks.
Sure, in your second query is fine in theory. You can't include date() inside double quoted strings and expect that to be evaluated, even if php does evaluate variables.
If you changed it to something like:
$result = dbquery('SELECT eid, title, datestart, dateend FROM events WHERE datestart > ' . date() . ' ORDER BY datestart');
You shouldn't have any more problems. If you've got the choice, and you aren't expecting any variables to be evaluated you should always try to use single quoted strings (') instead of double ("), there is a performance benefit.
Anonymous
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content