Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 673311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:34:56+00:00 2026-05-14T00:34:56+00:00

I need some help with an array and a foreach loop, I have an

  • 0

I need some help with an array and a foreach loop,

I have an array that is data returned from a database, basically it is a list of titles and images associated with it, it looks a little like this,

    Array
(
    [0] => Array
        (
            [contentImageId] => 28
            [contentImageName] => yellow.png
            [contentImageType] => .png
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/7/yellow.png
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265388055
            [contentId] => 7
            [dashboardUserId] => 0
            [contentTitle] => Another Blog
            [contentAbstract] => <p>This is another blog and it is shit becuase this does not work</p>
            [contentBody] => <p>ioasfihfududfhdufhuishdfiudshfiudhsfiuhdsiufhusdhfuids</p>
            [contentOnline] => 1
            [contentAllowComments] => 0
            [contentDateCreated] => 1265388034
            [categoryId] => 1
            [categoryTitle] => blogsss
            [categoryAbstract] => <p>asdsdsadasdsadfdsgdgdsgdsgssssssssssss</p>
            [categorySlug] => blog
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1266588327
        )

    [1] => Array
        (
            [contentImageId] => 31
            [contentImageName] => sophie.jpg
            [contentImageType] => .jpg
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/9/sophie.jpg
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265713423
            [contentId] => 9
            [dashboardUserId] => 0
            [contentTitle] => Bang appoints a new Senior Designer
            [contentAbstract] => <p>Bang has appointed a new Senior Designer in the wake of a number of major client wins.</p>
            [contentBody] => <p>After recently signing up clients including the National Trust and Propaganda, Bang has hired Sophie Smith to join its creative team.</p>

<p>Sophie brings over twelve years of extensive design experience in Bang's core market sectors, including social housing and public sector brands.</p>
<p>Sophie has significant experience of branding and strategic design projects for a broad range of clients, including HBoS, Harvey's, TKMaxx and Places for People.</p>
<p>Warren Watts Creative Director at Bang commented; "Sophie has already proven an invaluable addition to our growing studio. In only her second week, she helped produce the creative that led to the National Trust account win".</p>
            [contentOnline] => 1
            [contentAllowComments] => 0
            [contentDateCreated] => 1265713155
            [categoryId] => 8
            [categoryTitle] => News
            [categoryAbstract] => <p>The world at Bang Marketing moves fast, keep up to date w
            [categorySlug] => news
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1265283717
        )

    [2] => Array
        (
            [contentImageId] => 32
            [contentImageName] => selectadna.jpg
            [contentImageType] => .jpg
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/10/selectadna.jpg
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265713937
            [contentId] => 10
            [dashboardUserId] => 0
            [contentTitle] => Bang client experiences growth
            [contentAbstract] => <p>Selectamark, the UK's leading asset protection specialist recorded its best figures for five years in 2008.</p>
            [contentBody] => <p>The results were released during an extremely challenging economic climate, and just over 12 months into the organisation's relationship with Bang.</p>
<p>Bang has been working on developing Selectamark's range of product brands, which include the UK's leading asset tracking and labelling system Selectamark, and second generation forensic marking system, SelectaDNA. Despite gloomy national economic forecasts, Selectamark has enjoyed an extremely successful start to 2009 &ndash; picking up several major new clients in February, and with discussions taking place to expand operations beyond the UK and Netherlands to Germany and New Zealand.</p>

<p>Chris Garratt, Marketing Director at Bang Marketing Ltd explained "Selectamark adopted a well planned, coordinated and consistent strategy in 2008, and the results speak for themselves.</p>
<p>"Due to the success last year and the forecasts for increased levels of acquisitive crime we're hoping Selectamark's key products will enjoy similar growth in 2009".</p>
<p>Selectamark Security Systems provides DNA Forensic Marking products (SelectaDNA) and Visible Marking solutions (Selectamark and Logomark) to prevent burglaries, theft from void properties, theft of boilers, and theft of valuable metals such as lead from roofs. Selectamark have supplied these Secured By Design crime prevention products to Police, local authorities and housing associations for 25 years.</p>
<p>The Selectamark system has now marked over 25 million items, and is patented and distributed world-wide. Visit www.selectadna.co.uk for product details.</p>
<p>James Brown, Sales Director at Selectamark said "We have been absolutely delighted with the work Bang has done for us. In a short space of time, the Bang team has created a wide range of extremely fresh and professional-looking sales and marketing material for us to use, as well as devising a detailed marketing strategy which has now been implemented. We would have no hesitation in recommending Bang to other organisations."</p>
            [contentOnline] => 1
            [contentAllowComments] => 0
            [contentDateCreated] => 1265713888
            [categoryId] => 8
            [categoryTitle] => News
            [categoryAbstract] => <p>The world at Bang Marketing moves fast, keep up to date w
            [categorySlug] => news
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1265283717
        )
)

As you can see the contentTitle changes, everytime but sometime is returns the same content title, I am looking for a way to add a divide between the returned data, if the content Title value changes?

Is this possible? and how? I am really struggling here.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:34:56+00:00Added an answer on May 14, 2026 at 12:34 am

    As you loop through, you can have a temporary variable to store the last displayed title

    $lastTitle='';
    foreach ($array as $record)
    {
       if ($lastTitle != $record['contentTitle'])
         echo '<hr>';
    
        $lastTitle = $record['contentTitle');
    
        // display content from record
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 384k
  • Answers 384k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have basically two options here: add the self-signed certificate… May 14, 2026 at 11:17 pm
  • Editorial Team
    Editorial Team added an answer Set float: left on each <div>. May 14, 2026 at 11:16 pm
  • Editorial Team
    Editorial Team added an answer SELECT * FROM ( SELECT DISTINCT user_id FROM registrations )… May 14, 2026 at 11:16 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.