There is a data output from the table. I would like to know, nothing, that in the loop itself when outputting records from the support table , is the function used to output a count of comments (get__num__comments) , in which 1 query to the database? Is it correct?
// ΡΡΠ½ΠΊΡΠΈΡ Π²ΡΠ²ΠΎΠ΄Π° ΠΊΠΎΠ»-Π²Π° ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠ΅Π² function get_num_comments($id) { $query = mysql_query("SELECT * FROM `support_comments` WHERE `support_id` = '$id'"); return mysql_num_rows($query); } // Π²ΡΠ²ΠΎΠ΄ΠΈΠΌ Π·Π°ΠΏΠΈΡΠΈ ΠΈΠ· ΡΠ°Π±Π»ΠΈΡΡ support $query = mysql_query("SELECT * FROM `support`"); while($data = mysql_fetch_array($query)) { echo get_num_comments($data['id']); // ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ ΠΊΠΎΠ»-Π²ΠΎ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠ΅Π² ΠΊ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ Π·Π°ΠΏΠΈΡΠΈ }