Please help... MySQL problem... 1 Line

All forums need a place for all the posts for people in the community to rant about things not relating to what the forum is about. This is that forum.

Moderator: MacroQuest Developers

MoonRaverX
a ghoul
a ghoul
Posts: 91
Joined: Tue Dec 16, 2003 5:09 pm
Location: Tampa, Fl

Please help... MySQL problem... 1 Line

Post by MoonRaverX » Wed Apr 28, 2004 5:29 am

Ok, trying to get a number based on items purchased in 30 days.... what is wrong with this

Code: Select all

        
$total_purchased_items_30 = $db->query_first('SELECT count(*) FROM ' . ITEMS_TABLE . " WHERE item_buyer='" . $member['member_name'] .' WHERE item_date BETWEEN '.$thirty_days.' AND '.time().  "' ORDER BY item_date DESC");
all variables are correct, query seems wrong... any suggestions, o great ones?
-MoonRaverX
(Removed character from my sig due to owner of said character requesting me to.)

"ASCII stupid question, get a stupid ANSI"

Micro
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Mar 12, 2004 5:56 pm

Post by Micro » Wed Apr 28, 2004 10:58 am

my best guess is you have a problem with quoting, for example:

item_buyer='

you arnt ending that quote until ' ORDER BY item

it should read:

Code: Select all

" WHERE item_buyer='" . $member['member_name'] ."' AND item_date BETWEEN ".$thirty_days.' AND '.time().  "' ORDER BY item_date DESC");