Answer the question
In order to leave comments, you need to log in
How to make the path of the last comments to a particular section?
The database has 3 tables of videos, articles, photos.
Here is a database query
function get_last_comments($lang){
db_connect();
$query = "SELECT * FROM comments WHERE comments.lang = '$lang' ORDER BY comments.id DESC LIMIT 3";
$result = mysql_query($query);
$result = db_result_to_array($result);
return $result;
}
And this is the loop that I output
<?php foreach($last_comments as $item):?>
<?=$item['text'];?>
<?php endforeach;?>
I need to make the correct path to the sections that comments are left ?
Answer the question
In order to leave comments, you need to log in
The best option is to add another field in the comments table - target, to write 'article', 'photo', 'video' etc. there.
Otherwise, you will have to parse the link each time and, starting from the link, display where the comment was left
Thanks, I'll take a look!
Issue resolved
<?php foreach($last_comments as $item):?>
<?=str_size_title($item['text']);?>
<?php endforeach;?>
Wrote this code <?=$item['section '];?>
In the comment table there was a section field, just the path was not written correctly. Thanks, it works.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question