Good evening, there is such a request:
SELECT comments.id, comments.imageid, comments.whoComment, comments.comment, comments.date, comments.time, comments.timestamp, maincomments.id, maincomments.imageid, maincomments.whoComment, maincomments.linkToAudioComment, maincomments.date, maincomments.time, maincomments.timestamp FROM comments, maincomments WHERE comments.imageid = '{$imageid}' AND maincomments.imageid = '{$imageid}' LIMIT $start, $end Why and why it is not important :)
Next, I want to take whoComment and find the person who left the comment (no matter in which table, they are almost similar in structure, but need to be that way). I'm trying to do it like this:
for ($start = 0; $start < $end; $start++) { if($resultComments = mysqli_fetch_assoc($queryToGetComments)) { //Берем запись. Узнаем, кто ее написал, ищем на этого юзера информацию. $userName = $resultComments['whoComment'];//Но из какой таблицы подставится whoComment? Нужно, чтобы просто по порядку, в зависимости от сортировки в запросе (С сортировкой тоже проблема :( ) //Далее делаю, что хочу. } } The question is, actually, in php code, in the comments. But again, how to sort the data by date directly in the sql query? The field "Date" is in each table. I would be very grateful for the help!
SELECT ..., maincomments.whoComment AS mc_whocomment, ...FROM...fieldSELECT ..., maincomments.whoComment AS mc_whocomment, ...FROM...2) what sorting problems? you just don't have it - 4per