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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:14:07+00:00 2026-05-31T01:14:07+00:00

I am programatically generating a SQL statement that I then need to execute, however

  • 0

I am programatically generating a SQL statement that I then need to execute, however it is failing, I think due to not being escaped properly.

The SQL appears to be generated correctly in that I can cut and paste it from a browser and it executes correctly from the CMD line and PHPMyAdmin. Example:

CREATE TABLE IF NOT EXISTS `1_e6766037c49ccf8cc3f8437c123d6e88` 
(`intId` int(11) NOT NULL auto_increment,
`twitter_retweet_count` TEXT NULL ,......

I then try to execute it using CI with:

$query = $this->db->query($sql);

However it fails with:

You have an error in your SQL syntax; check the manual that corresponds to your 
MySQL server version for the right syntax to use near '
`twitter_retweet_count` TEXT NULL ,.......

Any thoughts on where I might be going wrong?

Many thanks, Ben.

  • 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-31T01:14:08+00:00Added an answer on May 31, 2026 at 1:14 am

    @adidasadida- thanks for your efforts. Your testing made me look further at the generate code and I realised I had an HTML character in there for display purposes (new line). This was the cause of the failure. Many thanks, Ben.

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

Sidebar

Related Questions

I'm running into an issue with Wicket generating markup for elements that programmatically need
What's a good method of programatically generating etag for web pages, and is this
We need to programatically burn files to CD in a C\C++ Windows XP/Vista application
I need to programatically determine whether .NET 3.5 is installed. I thought it would
I have a need to generate SQL queries against a variety of database providers,
When I'm generating a text file programatically, should I insert the ASCII EOF marker
I need help programatically graphing more points than can fit in a single Excel
I have written a Google App Engine application that programatically generates a bunch of
My understanding of SQL*Loader's conventional path is that it simply generates INSERT statements and
I am programatically generating mouse clicks when a user clicks a certain keyboard key

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.