Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

mysql insert issue


lifeisboost

Recommended Posts

Hello everyone. im trying to make a script to insert product descriptions in theo DB. the problem im having is with anything that has a ' in the desc. I.E. if the word "it's" is in the desc it fails the input into the DB. here is the error i get.

 

Invalid query: 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 't fit in the package with your order. Check out some other images from the ph' at line 1

 

if someone can shed some light this would help ALOT

Link to comment
Share on other sites

im trying to make a script to insert product descriptions in theo DB. the problem im having is with anything that has a ' in the desc. I.E. if the word "it's" is in the desc it fails the input into the DB.
Since the values that are in the sql query are often surrounded by quotes MySQL does not know your ' is not the end or beginning of one. The database entry therefore need to be done with a slash (\) in front of the '. osC has a built in function for that called tep_db_input. So look in categories.php how it handles incoming POST variables and uses the function tep_db_input (admin/includes/database.php) to prepare the input to include in queries.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...