Page 1 of 1

help....please.....im getting very nervous

Posted: Thu Dec 04, 2003 3:54 pm
by grudz
Hello,

i need to know not to show duplicates of a certain record within the column

example

question_title | question | reply (column names)

question1 | bla bla |
question1 | | reply

when i show my question, i dont want to see question1 twice

here is my code

Code: Select all

mysql_select_db($database_cnpa, $cnpa);
$query_forum = "SELECT DISTINCT * FROM forum ORDER BY `date` DESC";
$query_limit_forum = sprintf("%s LIMIT %d, %d", $query_forum, $startRow_forum, $maxRows_forum);
$forum = mysql_query($query_limit_forum, $cnpa) or die(mysql_error());
$row_forum = mysql_fetch_assoc($forum);

Posted: Thu Dec 04, 2003 4:02 pm
by xisle
As long as the answer row follows
the question row (Use GROUP BY if necessary)
you can do something simple like this...

Code: Select all

<?php
if($question != $last){
    print"{$question}";
    $last = $question;
}
?>