PHP code:

// открываем таблицу с пользователями $query = mysql_query("SELECT * FROM `users`"); while($data = mysql_fetch_array($query)) { $user_id = $data['uid']; // id пользователя // открываем материалы пользователя $query_ents = mysql_query("SELECT * FROM `ents` WHERE `uid` = '$user_id'"); while($data_ents = mysql_fetch_array($query_ents)) { echo ...; // шаблон материалов } } 

In general, there is a table of users and ents . Each user will display the entire list of his materials.

As far as I know, my code is bydlocod + query in a loop. Can I somehow do everything with one request?

Help with this, please ...)

    1 answer 1


     SELECT * FROM users, ents Where ents.uid=users.uid 
    • @Ale_x, how to add another example for the table logs? - ModaL
    • then the structures of the tables and the fields connecting them write - Ale_x