How do I make this select display according to what is selected there from the 'Latest, Evaluation, Utility' options ?:
Themostrecentwouldbethelastcommentsadded!Theevaluationwouldbethecommentthathadmorepositiveevaluationinstarsandwouldbelowering,forexample5,4,3etc...
AndtheUtilitywouldbethemostlikecomment.
ViewingNormalComments:
$selecionarComentarios=$conexao->prepare("SELECT a.id_mark, a.id_user, a.comment, a.rate, a.id, a.active, b.name, b.avatar FROM tb_comment a, users b WHERE a.id_user=b.id AND a.id_mark = :post_id ORDER BY id DESC LIMIT $start_pg, $amount_pg");
$selecionarComentarios->bindParam(':post_id',$post_id, PDO::PARAM_INT);
$selecionarComentarios->execute();
Via GET I got what I wanted !!
if (isset($_GET["op_com"]))
{
$op_com = $_GET["op_com"];
if($op_com=="recent")
{
$select_comment = "SELECT a.id_mark, a.id_user, a.comment, a.rate, a.id, a.active, b.name, b.avatar FROM tb_comment a, users b WHERE a.id_user=b.id AND a.id_mark = :post_id ORDER BY active DESC LIMIT ".$start_pg.", ".$amount_pg."";
}
if($op_com=="rating")
{
$select_comment = "SELECT a.id_mark, a.id_user, a.comment, a.rate, a.id, a.active, b.name, b.avatar FROM tb_comment a, users b WHERE a.id_user=b.id AND a.id_mark = :post_id ORDER BY rate DESC LIMIT ".$start_pg.", ".$amount_pg."";
}
if($op_com=="good")
{
$select_comment = "SELECT a.id_mark, a.id_user, a.comment, a.rate, a.id, a.active, a.good, b.name, b.avatar
FROM tb_comment a, users b
WHERE a.id_user=b.id AND a.id_mark = :post_id ORDER BY good DESC LIMIT ".$start_pg.", ".$amount_pg."";
}
}
else
{
$select_comment = "SELECT a.id_mark, a.id_user, a.comment, a.rate, a.id, a.active, b.name, b.avatar FROM tb_comment a, users b WHERE a.id_user=b.id AND a.id_mark = :post_id ORDER BY id DESC LIMIT ".$start_pg.", ".$amount_pg."";
}