...

View Full Version : mysql join and loop via php



slappyjaw
08-29-2009, 09:48 PM
i was wonderinig if there is a way to loop two tables in php. let me explain how it would need to work. i have tried a thousand time to get it to work but i cant. The script is part of my friends system that i made. when the user sends a friend request the other user recieves it. the mysql is set up so that is posts..
an
ID
USERFROM
USERTO
TIME
FORIDUS1
FORIDUS2
then once the person approves it deletes the request from the database and insert a row into the friends table like so...
ID
USERNAME
FRIEND
TIME
FRIENDID the friends id in the users table
the system inserts to rows and both are opposite. for example..
1 cuakster slappyjaw "time" 2
2 slappyjaw cuakster "time" 1
and that the way it is. so when i would create the php i would make it so that there was a connection to the friends table and the users table... ughh so i think i might have made it to complicated can someone please help me find a way to make a page display the friends a user has. thank you all:thumbsup:

funnymoney
08-30-2009, 01:16 AM
avoid using same names for fields
instead table field id name the field table_id, and other maybe users_id...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum