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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:25:35+00:00 2026-06-18T00:25:35+00:00

So, I am doing a bunch of things parsing an XML from 1 server,

  • 0

So, I am doing a bunch of things parsing an XML from 1 server, writing stuff into another server and then updating the mssql db! The whole process appeared to run smoothly until I ran the script from the terminal for the sake of FUN!
When I run it from the terminal, it throws in a bunch of warnings like:

PHP Warning:  mssql_query(): message: Incorrect syntax near 's'. (severity 15) in 
/Volumes/Data/Users/username/Desktop/createXML.php on line 375

PHP Warning:  mssql_query(): General SQL Server error: Check messages from the SQL 
Server (severity 15) in /Volumes/Data/Users/username/Desktop/createXML.php on line 375

PHP Warning:  mssql_query(): message: Unclosed quotation mark after the character 
string ';'. (severity 15) in /Volumes/Data/Users/username/Desktop/createXML.php on line 375

PHP Warning:  mssql_query(): General SQL Server error: Check messages from the SQL 
Server (severity 15) in /Volumes/Data/Users/pdwivedi/Desktop/createXML.php on line 375

PHP Warning:  mssql_query(): Query failed in /Volumes/Data/Users/username/Desktop
/createXML.php on line 375

Here is line 375:

$query = mssql_query("UPDATE table_name SET C_ITP_STATUS = '".$ITP_Status."', 
C_ITP_ERRORS = '". $ITP_Error ."' WHERE id = '".$ID."';"); 

The funny thing is that the query executes and I have an updated DB. But, it still shows these warnings when run from terminal. And I WANT TO get rid of them!
I MUST user MS SQL!!

Have tried looking around for solutions, but people hardly use MS SQL with mySQL being so much better (at least in terms of being widely used). Any help?

FUNNY THING: When I ONLY connect to the DB and perform this query in a new php script, it works fine and there are no warnings. Not sure why its like this!

RESOLVED:
I didnt care to test my input parameters (pretty lame) in to the string BECAUSE I was super confident about what I was doing! ALWAYS ESCAPE SPECIAL CHARS no matter how confident you are (just shouting out loud)!!

  • 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-18T00:25:36+00:00Added an answer on June 18, 2026 at 12:25 am

    It sounds to me like one of your input strings might contain a quote, and this is messing up the query. Your errors also indicate this. You should always treat all possible user input as tainted, and make it a habit to sanitize them every time, even if you don’t think you need to.

    I created a new php script and hard coded the 3 parameters and the query runs fine!

    This also leads me to believe that there is a quote or special character somewhere in your variables that is messing up the query. You would want to use mysql_real_escape_string() to correct this.

    $ITP_Status = mysql_real_escape_string($ITP_Status);
    $ITP_Error = mysql_real_escape_string($ITP_Error);
    $ID = mysql_real_escape_string($ID);
    $query = mssql_query("UPDATE table_name SET C_ITP_STATUS = '".$ITP_Status."', C_ITP_ERRORS = '". $ITP_Error ."' WHERE id = '".$ID."';"); 
    

    It should also be noted that you are using the old MySQL functions. The new MySQLi functions are the replacement, and what you should be using at a bare minimum.

    You mention MS SQL. If you plan on using that, you cannot use the MySQLi functions. In that case it is recommended that you use the PDO interface, which will work for both MySQL and MS SQL. Many recommend PDO over MySQLi even if you are only using MySQL.

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

Sidebar

Related Questions

I'm doing a whole bunch of stuff with an array of hashes, and learning
If I have a bunch of stuff in quotes I find myself doing something
I am trying to return some data retrieved from an xml file and then
I am writing a Firefox extension, which is doing two things (for the context
I have a little interactive script for doing a bunch of things with my
Doing my first SL4 MVVM RIA based application and i ran into the following
Okay, so I'm parsing some data from a webservice here. I'm just throwing in
I've got a bunch of methods in my application service layer that are doing
I have a bunch of AES256-encrypted ZIP containers (using DotNetZip), and I am writing
I’m writing C++ code to deal with a bunch of histograms that are populated

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.