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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:11:39+00:00 2026-05-20T10:11:39+00:00

I have gotten myself into a tangled mess with quotes. I am trying to

  • 0

I have gotten myself into a tangled mess with quotes.

I am trying to do a like query that looks something like this

$myQuery = 'SELECT col1 , col2 from my_table WHERE col_value LIKE '%$my_string_variable%';

But this query would obviously give an error. What is the right syntax for this? I tried messing with double-quotes, but that didn’t work either.

  • 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-20T10:11:40+00:00Added an answer on May 20, 2026 at 10:11 am

    Combine double and single quotes.

    $myQuery = "SELECT col1 , col2
                FROM my_table
                WHERE col_value LIKE '%$my_string_variable%'";
    

    Although I prefer to protect my code against SQL Injection..

    $myQuery = "SELECT col1 , col2
                FROM my_table
                WHERE col_value LIKE '%" . mysql_real_escape_string($my_string_variable) . "%'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have gotten myself a little confused with this. I am trying to make
I've seemed to have gotten myself into a bit of a pickle. I'm trying
I have gotten myself into a catch 22 and cannot seem to find my
I'm new to Java and have gotten myself into a situation where it's evident
I have gotten into the habit of declaring structs nested inside the class that
I've gotten myself into quite a tangle. I committed a restructuring change that significantly
I've gotten myself into a confused mess regarding multithreaded programming and was hoping someone
I have a table like this: | X | Y | Data | ----------------
I have gotten this to work nicely, but when speed hits a certain speed
I've been playing with XCode4 and seem to have gotten myself in a bit

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.