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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:33:23+00:00 2026-06-01T00:33:23+00:00

I was trying to perform a SQL statement and got some problems with encoding.

  • 0

I was trying to perform a SQL statement and got some problems with encoding. After escaping and encoding it, it returns a Syntax error which I am not capable to identify.

The statement is formed by the following code:

dbquery = "INSERT INTO series (id,nombreSerie,imdbUrl,urlPoster,descripcionEs,descripcionEn,rating,episodiosEn,episodiosEs,estado,firstAired,airDay,Network) VALUES (" + t['gossip girl']['id']+ "," + t['gossip girl']['seriesname'] + ',http://imdb.com/title/' + t['gossip girl']['imdb_id'] + "," + t['gossip girl']['poster'] + "," + t['gossip girl']['overview'][:400] + "... ,"+ t['gossip girl']['overview'][:400] + "... ," + t['gossip girl']['rating'] + "," + total + "," + total + "," + t['gossip girl']['status'] + "," + t['gossip girl']['firstaired'] + "," + t['gossip girl']['airs_dayofweek'] + "," + t['gossip girl']['network']+")"
cursor.execute (MySQLdb.escape_string(dbquery))

Printing the execution returns the following:

print MySQLdb.escape_string(dbquery)
INSERT INTO series (id,nombreSerie,imdbUrl,urlPoster,descripcionEs,descripcionEn,rating,episodiosEn,episodiosEs,estado,firstAired,airDay,Network) VALUES (80547,Gossip Girl,http://imdb.com/title/tt0397442,http://www.thetvdb.com/banners/posters/80547-6.jpg,Gossip Girl satirizes and revolves around the lives of young Manhattan socialites growing up on New York City\'s Upper East Side who attend elite academic institutions while dealing with sex, drugs, jealousy, and other teenage issues.... ,Gossip Girl satirizes and revolves around the lives of young Manhattan socialites growing up on New York City\'s Upper East Side who attend eliteacademic institutions while dealing with sex, drugs, jealousy, and other teenage issues.... ,8.1,0x11|1x18|2x25|3x22|4x22|5x24|,0x11|1x18|2x25|3x22|4x22|5x24|,Continuing,2007-09-19,Monday,The CW)

And the error I get is this one:

File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in default errorhandler raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "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 'Girl,http://imdb.com/title/tt0397442,http://www.thetvdb.com/banners/posters/8054' at line 1")

I know that the commas on the big string may be affecting the sql syntax, but I have replaced the commas and it doesn’t seem to affect the query execution.

Sorry if this is very simple, but I haven’t found any answer on the web (maybe I am not searching well)

Thank you in advance

  • 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-01T00:33:24+00:00Added an answer on June 1, 2026 at 12:33 am

    Strings have to have ” around them, you should have

    Values (80547,'Gossip Girl','http://imdb.com/title/tt0397442,http://www.thetvdb.com/banners/posters/80547-6.jpg', etc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to perform a bitwise NOT in SQL Server. I'd like to do
Trying to perform a single boolean NOT operation, it appears that under MS SQL
I am trying to perform a simple calculation to some data returned from SQL
I'm trying to perform a SQL query through a linked SSAS server. The initial
I am trying to perform a bulk insert onto SQL Server: BULK INSERT SampleData
I'm using Linq to SQL for the Database operations, and am trying to perform
I am trying to perform a SQL query that acts in two parts. First,
I'm trying to perform some offline maintenance (dev database restore from live backup) on
An interruption exception (java.lang.InterruptedException) occurs as I'm trying to perform some simple read (SELECT)
I am trying to perform a simple update query in MS SQL. In mysql

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.