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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:08:33+00:00 2026-05-13T22:08:33+00:00

Rather new to php, so sorry if this seems stupid. I’m really copying a

  • 0

Rather new to php, so sorry if this seems stupid. I’m really copying a lot of this from previously written code from other developers at my company.

The way we run a query is basically like this:

$qry = new SQLQuery;
$sqlString = "SELECT * FROM database.table WHERE table.text = '" . 
              $textVar . "' and table.text2 = '" . $text2Var."'";
$qry->prepare(String::Condense($sqlString));
$qry->execute();

The problem I’m having is that $textVar or $text2Var may legitimately have question marks (?) in them as part of their text, this is causing the query SQLQuery class to break treating the question mark as a variable I’m not passing it.

So how can I instruct the SQLQuery class to ignore question marks?

p.s. I’m sure there’s terminology for a lot of this that I don’t know, please keep that in mind when giving me an answer.

  • 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-13T22:08:33+00:00Added an answer on May 13, 2026 at 10:08 pm

    You want your prepared statement $sqlString to have ? where you are putting $textVar and $text2var, and then you need to bind those to the statement.

    It’s treating them as placeholders because they look like placeholders when you prepare your SQL.

    So:

    $sqlString = "SELECT * FROM database.table WHERE table.text = ? and table.text2 = ?"
    

    You should take a look at MySQL Prepared Statements and familiarize yourself with how they work and what benefits they provide.

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

Sidebar

Related Questions

I'm new here, also a novice programmer, and not really familiar with PHP. I
I am rather new to using the command line and php. That being said
I joined a new company about a month ago. The company is rather small
I want to use the new report builder 2.0, rather than the old VS2005
When starting out with a new application, would you rather just use an existing
Rather than scraping a Ruby version of this algorithm off the net I wanted
A rather odd experience. Using the latest PDK (v7.3) from ActiveState, I used perlctrl
This is an incredibly simple question (I'm new to Python). I basically want a
Rather than population said DOM object with an external page such as HTML CFM
I have a rather large file (150 million lines of 10 chars). I need

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.