Page 1 of 1

a complicated query

Posted: Sat Apr 30, 2005 3:19 pm
by shiznatix
i need to make this query work

Code: Select all

$query = "SELECT * FROM mdl_sm_info WHERE fk_target_group_id='$_SESSION[fk_group_id]'";
	$query .= " OR fk_target_user_id='$_SESSION[user_id]' OR WHERE fk_target_user_id='0'";
	$query .= " AND fk_target_group_id='0' ORDER BY message_id DESC";
but the OR WHERE is giving me a sql syntax error. how should i do that query to make it all work

Posted: Sat Apr 30, 2005 3:26 pm
by hawleyjr
Only use WHERE once. use () if you need to group items.

Posted: Sat Apr 30, 2005 3:29 pm
by shiznatix
thanks much