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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:09:12+00:00 2026-06-11T07:09:12+00:00

I am getting a syntax error with the follow code snippet: $handle = $table.’_’.$field;

  • 0

I am getting a syntax error with the follow code snippet:

    $handle = $table.'_'.$field;
    if($queryType=='replace') {
        $sql[$handle]['sql'] = 'UPDATE '.$table.' SET '.$field.' = replace(replace(replace('.$field.',\''0', ''), '1', ''), '2', '')';
    } else {
        $sql[$handle]['sql'] = 'SELECT * FROM '.$table.' WHERE '.$field.' REGEXP(\''.$search.'\')';
    }

I am sure I have just forgot something small but I cant seem to find out what is causing the error.

Any help would be much appreciated.

  • 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-11T07:09:14+00:00Added an answer on June 11, 2026 at 7:09 am

    Your syntax error comes from line 3 of the snippet you provided: the end of that line, ',\''0', ''), '1', ''), '2', '')';, is causing the problem because the single quotes that are supposed to be a part of your SQL statement aren’t escaped. Rather than escaping all of them, it’s much simpler to just use double quotes to contain that part instead, like this: ",''0', ''), '1', ''), '2', '')";

    Also, your current code is highly susceptible to SQL injection.

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

Sidebar

Related Questions

I am getting syntax error with the following statement REPLACE INTO users (screenname, token,
I'm getting syntax error in firebug here is the code : $('#moderator-attention').live('toogle', function(){ function
Why am I getting a syntax error with the following line? statement = self.sql.execute(DESCRIBE
i am using this code <a onclick=javascript:var t=setInterval(GetUpdates(5,ajaxResult),300);>GetUpdates</a> but getting the syntax error
I'm getting syntax error for Hibernate 3.3.2 generated queries containing double-quotes: create table tbl_version
I keep getting a syntax error everytime I try to load the follow manifest.json:
getting error 04-12 08:38:33.943: E/Database(441): Failure 1 (near Table: syntax error) on 0x341088 when
I'm trying to do: raw_input(Anyone Home?) But I'm getting syntax error! I'm using Python
I'm getting a syntax error with this access query, but I can't see what
I'm getting $ syntax error, unexpected keyword_class, expecting keyword_do or '{' or '(' in

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.