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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:36:13+00:00 2026-06-03T06:36:13+00:00

quicky one, I’m creating search query and I’m stuck with one problem… with this

  • 0

quicky one, I’m creating search query and I’m stuck with one problem… with this code.

this code is working perfectly but I need to add this validation to it, problem comes when I add this validation userid='$id', the search query is not working with it. Can someone put me on the right way? I’m missing something here. The value of $id is true for sure. This is the whole code part for this search query the result is ok without validation.

else if($_POST['filter1'] == "po_boravistu")
        {
            if($row_12['admin_id'] < 1)
                {
            //FILTER 10 po boravištu
$sqlCommand = "SELECT * FROM albums WHERE userid='$id' AND WHERE bor_mjesto LIKE '%$searchquery%' OR bor_kucni_broj LIKE '%$searchquery%' OR
bor_postanski_broj LIKE '%$searchquery%' OR bor_ulica LIKE '%$searchquery%' OR bor_opcina LIKE '%$searchquery%'";
                }
        }

Whole script is working fine without userid='$id' in it, but when I add that validation script drops dead.

  • 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-06-03T06:36:15+00:00Added an answer on June 3, 2026 at 6:36 am

    Your SQL is invalid because you have 2 WHERE clauses.

    Change it to:

    $sqlCommand = "SELECT * FROM albums WHERE userid='$id' AND (bor_mjesto LIKE  %$searchquery%' OR bor_kucni_broj LIKE '%$searchquery%' OR bor_postanski_broj LIKE '%$searchquery%' OR bor_ulica LIKE '%$searchquery%' OR bor_opcina LIKE '%$searchquery%')";
    

    (note the use of parentheses to surround the multiple “OR” statements)

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

Sidebar

Related Questions

This is just a quick one but I cant find what i need to
Hopefully a nice and quick one for you... the below code is working fine
Hopefully this is a quick one for someone in the knowledge but i am
This is a quick one. In Linq to sql, I need to order by
This is a quick one. I have the following code: foreach (var item in
Hopefully this is a quick one for someone! I've been searching for a while
Hopefully a quick one... I need to fire the uncheckAll event in the click
Just a quick one, hopefully. I've coded up this: <script> $(div.design-project).css('display', 'none'); function InsertContent(tid)
Is it possible to move quickly from one place in code to another where
Quicky question on SQLite3 (may as well be general SQLite ) How can one

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.