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

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

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

Post 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);
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post 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;
}
?>
Post Reply