Page 1 of 1

mysql_seel_data question

Posted: Fri Sep 19, 2003 4:08 am
by yaron
Hello all,
I made 2 quries in 2 different tables.
What I want is to loop all values of one of my result and look if somewhere there is the same value in the second table result and get this row to compare.
example:
$result = mysql_query(sqlstmt);
$result2 = mysql_query(sqlstmt2);
while ($arr=mysql_fetch_array($result))
{
/*Here I need to look for a specific filed value in $result 2*/
if($arr['name'] exsists in $result2)
fetch_row in $result2
}

of course dont mind the syntax, its just to get my idea crossed.
Thanks

more explanation

Posted: Fri Sep 19, 2003 4:36 am
by yaron
what I mean is:
assuming I return a mysql result set from an SQL query, with multiple
rows of:


field1, field2, field3


is it possible to use something like mysql_data_seek, but set the
pointer based on a specific text value of a field,
as opposed to specifying a row number?

Posted: Fri Sep 19, 2003 5:56 am
by volka
probably you can let mysql do the work for you.
take a look at http://www.mysql.com/doc/en/JOIN.html
and create a join-query that returns the records having matching fields