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

The Archive Base Latest Questions

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

Let me explain this as best as I can. I have PHP file named

  • 0

Let me explain this as best as I can.

I have PHP file named funcs.php in which is exactly this PHP code:

$q = $_GET["q"];

$sql = "SELECT * FROM bl_zrify WHERE Name = '".$q."'";

$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
  {

  if ($row['State'] == '') {
    $SchoolState = 'Unknown';
  }
  else if ($row['State'] == 'AL') {
    $SchoolState = 'Alabama';
  } 
  else if ($row['State'] == 'AK') {
    $SchoolState = 'Alaska';
  } 
  else if ($row['State'] == 'AZ') {
    $SchoolState = 'Arizona';
  }
  else if ($row['State'] == 'AR') {
    $SchoolState = 'Arkansas';
  }

  print 'This school is in';
  print $SchoolState;
  }

When I call in my browser:

url example => http://www.domain.com/funcs.php?q=ABRAHAM BALDWIN AGRICULTURAL COLLEGE

It normally works and returns => This school is in Alabama

But when when i call in my browser any URL which have & (&) inside, won’t work at all:

url example => http://www.domain.com/funcs.php?q=BRYANT & STRATTON BUSINESS INSTITUTE – BUFFALO

I don’t know why, but for some reasson I get no results when there is amp (&) in URL, please HELP!

  • 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-26T04:59:59+00:00Added an answer on May 26, 2026 at 4:59 am
    funcs.php?q=BRYANT & STRATTON BUSINESS INSTITUTE - BUFFALO
    

    You are passing two variables. Do a var_dump($_GET); and you will see.

    You probably meant:

    funcs.php?q=BRYANT+%26+STRATTON+BUSINESS+INSTITUTE+-+BUFFALO
    

    To pass values for parameters in URLs, they need the proper encoding. Also called url-encoding. & is a special character that needs to be written as %26, space is a special character as well, can be written as + or %2b. Also called percent- or triplet-encoding.

    A function in PHP that does this is: urlencodeDocs.

    In any case you need to properly encode as well the search term for the SQL query, otherwise you allow others to alter the SQL query and do stuff like searching more than you want and even delete your database. That’s a more serious issue than losing half a variable’s value.

    See: Best way to stop SQL Injection in PHP

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

Sidebar

Related Questions

Let me try to explain this the best I can. I have a component
Let me try to explain this to the best of my ability: I have
It's hard to put this into the title, so let me explain. I have
Let me try to explain the situation the best I can. Lets say I
Let's say I have a class A which can fire an event called X.
Ok, let me try and explain this to the best of my ability. Lets
Let me explain: this is path to this folder: > www.my_site.com/images And images are
This question might not seem programming related at first, but let me explain. I'm
So I am having a few problems with settings this up. Let me explain.
let me explain my current situation i have a SharePoint site lets say it

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.