Jump to content

Recommended Posts

Hi, here is my sql staement:

 

SELECT *
FROM articlecategory, articles
WHERE articles.articlecategoryid = articlecategory.articlecategoryid

 

And here I echo this in a while loop:

 

<?php echo $row_news['articlecategoryname']; ?></strong><br>
<?php echo $row_news['articlesummary']; ?></p>

 

Trouble is I only want 1 article suammary under each article category heading, and i am getting all the results.

 

Any ideas please?

Link to comment
https://forums.phpfreaks.com/topic/87297-query-help/
Share on other sites

Thanks for your reply. I would like the out put to look like

 

Article Category Title

Article Summary

 

And this is repeated, one article summary underneath each differant article title.

 

How could i use group by to achieve this - i have only used it to count?

 

Thanks.

 

 

Link to comment
https://forums.phpfreaks.com/topic/87297-query-help/#findComment-446755
Share on other sites

Hi,

 

i thought you would tell me some example with dummy data shell i consider something like below

 

article1  first category artic

article1 second article summary

article2 second arti

article2 second article summary second article

 

article1

    dirst category art

    second artieldf

article2

  summary of articel two

 

????

 

Regards

 

Link to comment
https://forums.phpfreaks.com/topic/87297-query-help/#findComment-446876
Share on other sites

hi greenday,

 

well i tried one query to help you i.e

 

SELECT asummary FROM `article` group by (aTitle)

 

it showed me one article per category.just give a try and let me know weather it solves your problem or not.which server side scripting you are using to show the result?? PHP?

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/87297-query-help/#findComment-447533
Share on other sites

Guest
This topic is now 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.