Does this help? Select * From Projects Order By Relate,Title If not, please provide more details on the output you want to see and the structure of your table Mark -----Original Message----- From: Ahmed Abdel-Aliem [mailto:me2resh@xxxxxxxxx] Sent: 02 May 2005 21:49 To: php-general@xxxxxxxxxxxxx Subject: setting condition problem hi all i have a query that grabs records from the database, it works fine, but i have a problem with acondition i want to set for it the variable $Record[Relate] has 1 of 2 values, "self" or "share" what i wanna do is that when the variable has the value "share" it do check the records grabbed and get the other records that has the value share and $Record[Title] the same and display them once, i don't know how to start doing this, can anyone guide me or tell me how to do it thanks in advance here is the query <? $Query = "SELECT ID FROM projects"; $Result= mysql_query($Query); $Total_Numbers = mysql_num_rows($Result); $StartingID=$_GET['StartingID']; $StartingID = ($StartingID) ? $StartingID : 0; //if rec is passed in, use it, $Row = array(); $Query = mysql_query("SELECT * FROM projects ORDER BY ID DESC LIMIT $StartingID,$Items_Numbers"); $Num = mysql_num_rows($Query); while ($Record=mysql_fetch_array($Query)){ $Record[ID] = stripslashes($Record[ID]); $Record[User] = stripslashes($Record[User]); $Record[Relate] = stripslashes($Record[Relate]); $Record[Thumb] = stripslashes($Record[Thumb]); $Record[Shot] = stripslashes($Record[Shot]); $Record[Title] = stripslashes($Record[Title]); $Record[Link] = stripslashes($Record[Link]); $Record[Type] = stripslashes($Record[Type]); $Record[Skill] = stripslashes($Record[Skill]); $Record[Info] = stripslashes($Record[Info]); $Record[Time] = stripslashes($Record[Time]); $Record[Date] = stripslashes($Record[Date]); $Record[Rate] = stripslashes($Record[Rate]); $Record[Raters] = stripslashes($Record[Raters]); $Row[] = $Record; } $Next = $StartingID+$Items_Numbers; $Prev = $StartingID-$Items_Numbers; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ********************************************************************** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com E&OE ********************************************************************** ********************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php