mysql_seel_data question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yaron
Forum Contributor
Posts: 157
Joined: Fri Aug 22, 2003 8:40 am

mysql_seel_data question

Post 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
yaron
Forum Contributor
Posts: 157
Joined: Fri Aug 22, 2003 8:40 am

more explanation

Post 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?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
Post Reply