Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.