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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:15:28+00:00 2026-06-16T10:15:28+00:00

Please help me with this syntax. Is this correct? $query = mysql_query(SELECT * FROM

  • 0

Please help me with this syntax. Is this correct?

$query = mysql_query("SELECT * FROM axispl WHERE companyname LIKE $searchterm% LIMIT 11");

In few examples on the net I have seen ` symbol being used to enclose axispl or companyname. In few they are not present. What is the difference?

My database has 2 columns. First has company names. Second has the category they fall in to. I basically want the query to select 11 of these pairs when the company name matches the searchterm.

Should I mention SELECT * or should I mention SELECT companyname, axiscategory ? (these are the names of the two columns).

If the above syntax is not correct, what should I change?

  • 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-16T10:15:29+00:00Added an answer on June 16, 2026 at 10:15 am

    You need to quote the search term with single quotes.

    $query = mysql_query("SELECT * FROM axispl WHERE companyname LIKE '".mysql_real_escape_string($searchterm)."%' LIMIT 11");
    

    It does not really matter if you use SELECT * or specify the columns – the latter is usually a little bit faster but it usually doesn’t matter if you need all columns anyway.

    Regarding your quoting question:

    • Always escape strings you pass into a query.
    • Use single quotes to quote strings used in a query
    • Backticks are used to quote database/table/column names and only necessary if they collide with reserved keywords.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone help me out with the correct syntax for this query please. I
Please help me with this update query. I COMPLETELY understand how redundant this is
Please help me solve this problem with capybara I have a button like this
I am working on Visual C++. Can you please help in this syntax .
Please can you guys help me check if my syntax is correct. I don't
I have a dynamic query like this : SET @str_Query = 'SELECT SIM.Item_ID, SIM.Item_Description,
Please help this would be my last problem in dealing with access database with
Please help this beginner here... I have a SQL Server 2008 R2 running on
please help me on this homework: makeA({0: 1, 2: 1, 4: 2, 6: 1,
Please help me about this issue... In my application i have calender where user

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.