View Single Post
Old 08-05-2007, 10:17 PM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
do you have access to a mysql manager like phpmyadmin? if so, print out your sql and run it in phpmyadmin. it should point you to the error or at least show you that you are getting blank results.

Code:
$sql = "
		SELECT *
		FROM roster, dates, members
		WHERE (
			(roster.rosterMemberID = members.memberID)
		AND
			(roster.rosterDateID = dates.dateID)
		
			)
		ORDER BY 
		".$orderby." DESC";
echo $sql;
exit;
now looking at the query, i don't see any where clause which specifies a date. as i understand it, this query would return all rows in your database.

i don't know your db structure well, but you could always try a left join:
Code:
SELECT *
		FROM roster
LEFT JOIN members on members.memberID=roster.rosterMemberID
LEFT JOIN dates on dates.dateID=roster.rosterDateID
		ORDER BY 
		".$orderby." DESC";
so now, if i'm on the right track anyway, we would want to add a clause to only select values with a specific date. unfortunately i have no idea what field it comes from. you have a variable: $dateDate in your code which is never assigned, yet you're using substr on it.

you need to take this down to smaller chunks and then put it together. work on a good query, then work on the logic to print it to the screen.
__________________
Mike
sde is offline   Reply With Quote