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

  • SEARCH
  • Home
  • 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 3698532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:59:33+00:00 2026-05-19T04:59:33+00:00

I am trying to use these if/else if statements to display these php pages.

  • 0

I am trying to use these if/else if statements to display these php pages. The if/elseif statements allow for the php page to show up. The data is stored in the mysql. How do we get it so that if its already being displayed it only enters once? Thank you. I hope you can help. Sorry this is a little confusing. I just learned English recently.
Thank you.

if ($result_array[0] = Politics) {
        require 'news/political.php';
    } elseif ($result_array[0] = Gossip) {
        require 'news/celebgossib';
    }   elseif ($result_array[0] = Entertainment) {
            require 'news/entertainment.php';
        }   elseif ($result_array[0] = Finance) {
                require 'news/finance.php';

            }   elseif ($result_array[0] = Health) {
                    require 'news/health.php';
                }   elseif ($result_array[0] = Leisure) {
                        require 'news/leisure.php';
                    }   elseif ($result_array[0] = Sports) {
                            require 'news/sports.php';
                        }   elseif ($result_array[0] = Tech) {
                                require 'news/tech.php';
                            }   elseif ($result_array[0] = World) {
                                    require 'news/world.php';
                                } else {
                                    echo "There is no interests in your database";
                                }

                                if ($result_array[1] = Politics) {
                                    require 'news/political.php';
                                } elseif ($result_array[1] = Gossip) {
                                    require 'news/celebgossib';
                                }   elseif ($result_array[1] = Entertainment) {
                                        require 'news/entertainment.php';
                                    }   elseif ($result_array[1] = Finance) {
                                            require 'news/finance.php';

                                        }   elseif ($result_array[1] = Health) {
                                                require 'news/health.php';
                                            }   elseif ($result_array[1] = Leisure) {
                                                    require 'news/leisure.php';
                                                }   elseif ($result_array[1] = Sports) {
                                                        require 'news/sports.php';
                                                    }   elseif ($result_array[1] = Tech) {
                                                            require 'news/tech.php';
                                                        }   elseif ($result_array[1] = World) {
                                                                require 'news/world.php';
                                                            } else {
                                                                echo "There is no interests in your database";
                                                            }
  • 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-19T04:59:33+00:00Added an answer on May 19, 2026 at 4:59 am

    Something like:

    $pages = array(
      'Politics' => 'political',
      'Gossip' => 'celebgossib',
       ...
    );
    
    $used = array();
    
    for ($i = 0; $i < 2; ++$i)
    {
       if (array_key_exists($result_array[$i], $pages)
       {
          if (!array_key_exists($result_array[$i], $used))
          {
             # only display this section once
             include 'news/'.$pages[$result_array[$i]].'.php';
             $used[$result_array[$i]] = true;
          }
       }
       else
       {
          echo "Nothing to see here.";
       }
    }
    

    I’m not sure exactly what you want to do if the page isn’t found; or if subsequent records are duplicates.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to harden some of my PHP code and use mysqli prepared statements
i'm trying to use mysqli to display data, but it displays nothing. what is
I am trying to use the peek function in Visual Studio 2010 with these
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I'm trying to go through a series of numbered data pages using urlib2. What
HI there, I'm trying to use UIScreen to drive a separate screen with the
I'm trying to use Zlib::Deflate.deflate on a massive file (4 gigs). There are obvious
I am trying to use this code in my QT app QMap<QString,QMap> but there
For those familiar with Excel, I'm trying to use a similiar NETWORKDAYS function within
Is there a definitive gem for the YouTube API? I'm trying to use youtube_g,

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.