Jump to content

[SOLVED] List Help


verdrm

Recommended Posts

Is there a way to echo only one thing of a similar name? For example, if I have four posts, two in column (MySQL) 'Title' named 'Post' and two in column 'Title' named 'Draw', so on the PHP page:

 

Post Title

 

Post

Post

Draw

Draw

 

how can I echo just one of each name?

 

I would like the above to look like:

 

Post Title

 

Post

Draw

Link to comment
https://forums.phpfreaks.com/topic/73021-solved-list-help/
Share on other sites

Thanks, that worked! Now, the only problem is that I also have dates next to the post names, which I forgot to mention.

 

Post Title        Revision Date

 

Post              Oct 12, 2007 7:03:43 PM EDT

 

 

How do I use DISTINCT when dealing with dates?

Link to comment
https://forums.phpfreaks.com/topic/73021-solved-list-help/#findComment-368222
Share on other sites

The dates are different. I would like the most current date. If it helps, my code looks like this:

 

<?php

$query = "SELECT DISTINCT title,date FROM info WHERE group_id = '".$_SESSION['ferpa']."' ORDER BY date DESC";

$result = mysql_query($query);

?>

<?php

while(list($title,$date) = mysql_fetch_array($result, MYSQL_NUM))

{

 

?>

 

I can get distinct TITLES but the corresponding dates do not echo.

Link to comment
https://forums.phpfreaks.com/topic/73021-solved-list-help/#findComment-368245
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.