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 7170263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:10:32+00:00 2026-05-28T15:10:32+00:00

As per $query = mysql_query(SELECT * FROM `pages` WHERE parent_id = ‘0’ AND menu_location

  • 0

As per

$query = mysql_query("SELECT * FROM `pages`
                      WHERE parent_id = '0'
                            AND menu_location NOT IN (main,footer)");

I’m trying to select all pages from database table where the parent id is 0 and the page is not in the main menu or footer menu, so I want to select all apart from if these pages are set to either of these menus.

There are multiple menu_location types so I don’t believe I can use NOT NULL for example.

I’ve got a feeling I’m probably use the NOT IN statement out of context, but if anyone could kindly point me in the right direction on how to query the database properly, I would be very grateful.

EDIT.

Table: 'pages'
Table Columns: 'active', 'page_id', 'parent_id', 'order', 'site_id',
               'page_name', 'page_display_name', 'page_location', 'page_type',
               'menu_location' 
               (there are other columns but mainly for content, metadata etc).

I just simply want to select all pages from table apart from those which have main and footer in the menu_location column. 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-28T15:10:34+00:00Added an answer on May 28, 2026 at 3:10 pm

    Just surround main ad footer values with '':

    $query = mysql_query("SELECT * FROM `pages`
                          WHERE parent_id = '0'
                                AND menu_location NOT IN ('main','footer')");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query that retrieve the number of users per country; SELECT
Per man pages, snprintf is returning number of bytes written from glibc version 2.2
Please note that this question is not about the mysql query per se, but
I have a query that is basically like this: SELECT foo FROM bar where
The following query returns the total amount of orders, per week, for the past
Per a great answer from another question I have begun mounting global resources (css/js/images)
I have a pagination script that displays a list of all pages like so:
<?php $objConnect = mysql_connect(localhost,,root) or die(mysql_error()); $objDB = mysql_select_db(mydb); $pic2 = SELECT * FROM
*EDIT*** I've made great progress by combining the main query that pulls the airwaves
Update mysql with $_POST data from while loop I'm trying to get this round

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.