Hi, Sorry if this does not make sense but is hard to explain what i am trying to achieve. I have a website which has 2 parts to it, one section is where people tell post saying they are going to e.g. city1 on such a date and another section where people can post saying that they want to go to e.g. city1 on such a date. What i am trying to do is when a user logs into the website and have posted on section one or two then i want to list any matched items and list them. So in code terms what i am trying to do is: $selects = mysql_query("SELECT * FROM table WHERE userid = '$session[id]'"); $countrows = mysql_num_rows($selects); if ($countrows > 0){ $results = mysql_query("SELECT * FROM table WHERE city = '???'"); $row = mysql_fetch_assoc($results); mysql_free_result($results); echo "Match" } Code (markup): Cheers, Adam
Rather quick and simple way of doing it.. $query = mysql_query("SELECT * FROM table WHERE userid = '$session[id]' AND date LIKE '%?%' OR city LIKE '%?%'"); if (mysql_num_rows($query) > 0) { while ($result = mysql_fetch_array($query)) { echo $result['date'] . "/" . $result['city'] . "<br />"; } } PHP: Modify to fit your desires.
Will that work as i cannot see it doing. What it needs to do i think.. is go through all the records that a user has and pulls out the city from each record. Then maybe put them into an array and check through all other records to see if any match to this user.