web_master Posted September 9, 2011 Share Posted September 9, 2011 Hi, I got a problem with two tables. There is a one with users, and the other is with logs of the users. USERS table - ID - name LOGS table - ID - users_ID - log_datetime I want to list this tables like this Name 1 - log_datetime - log_datetime - log_datetime... Name 2 - log_datetime - log_datetime - log_datetime... Name 3 - log_datetime - log_datetime - log_datetime... So, every names just one time, and below every log belong to that name... Thanks.. T Quote Link to comment https://forums.phpfreaks.com/topic/246790-two-tables-problem/ Share on other sites More sharing options...
AyKay47 Posted September 9, 2011 Share Posted September 9, 2011 in your case it sounds like you will want to use a JOIN query.. For information on using a JOIN query, look here Quote Link to comment https://forums.phpfreaks.com/topic/246790-two-tables-problem/#findComment-1267375 Share on other sites More sharing options...
web_master Posted September 9, 2011 Author Share Posted September 9, 2011 in your case it sounds like you will want to use a JOIN query.. For information on using a JOIN query, look here Yes, I want to JOIN tables, thats OK, but after JOIN when I list its looks like this: Name 1 - log 1 Name 1 - log 2 Name 1 - log 3 Name 2 - log 1 Name 2 - log 2 Name 2 - log 3 .... Quote Link to comment https://forums.phpfreaks.com/topic/246790-two-tables-problem/#findComment-1267380 Share on other sites More sharing options...
AyKay47 Posted September 9, 2011 Share Posted September 9, 2011 can you post the relevant query code please Quote Link to comment https://forums.phpfreaks.com/topic/246790-two-tables-problem/#findComment-1267384 Share on other sites More sharing options...
web_master Posted September 9, 2011 Author Share Posted September 9, 2011 can you post the relevant query code please $Querylog = mysql_query(' SELECT p_users.p_users_id, p_users.p_users_nick, p_users_log.p_users_log_id, p_users_log.p_users_log_user, p_users_log.p_users_log_datetime FROM p_users Inner Join p_users_log ON p_users.p_users_id = p_users_log.p_users_log_user ORDER BY `p_users_log_user` ASC '); if(!$Querylog){ echo mysql_error(); exit; } while($request_log = mysql_fetch_array($Querylog)) { } Quote Link to comment https://forums.phpfreaks.com/topic/246790-two-tables-problem/#findComment-1267387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.