title: Syntax error using ODBC driver for SQL Server
body: <p>I am trying to make a item shop for a game server and I am using code written by someone else. I have worked my way through a few errors but this one has me scratching my head. </p>
  
  <p>On the return trip from PayPal sandbox I end up with this error. </p>
  
  <blockquote>
    <p>The Error : SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL
    Server][SQL Server]Incorrect syntax near '='. The Error in :
    C:\inetpub\wwwroot\shop\include\querydbSQL.php Line : 98</p>
  </blockquote>
  
  <p>I have already confirmed the PDO drivers, PHP versions, MySQL and SQLSERVER access.  </p>
  
  <pre><code>function Update($dbname, $table, $array, $where) {
      try {
          $parts = array();
          foreach ($array as $key =&gt; $value) {
              $parts[] = "[" . $key . "] = '" . $value . "'";
          }
          $sth = $this-&gt;dbSql-&gt;prepare("UPDATE [$dbname].[dbo].[$table] SET " . implode(",", $parts) . " WHERE $where");
          $data = $sth-&gt;execute();     &lt;-------- Line 98 
          return $data;
      } catch (Exception $ex) {
          if(DEV_MODE === true){
              echo "The Error : " . $ex-&gt;getMessage() . "&lt;br /&gt;";
              echo "The Error in : " . $ex-&gt;getFile() . "&lt;br /&gt;";
              echo "Line : " . $ex-&gt;getLine() . "&lt;br /&gt;";
          } else {
              echo "[2004]The System has some error, Please contact with Administrator!";
          }
          die;
      }
  </code></pre>
  
  <p>Any guidance at all is greatly appreciated. Thank you!</p>
  
  <pre><code>function SelectWhere($dbname, $table, $where) {
      try {
          $sth = $this-&gt;dbSql-&gt;prepare("SELECT * FROM [$dbname].[dbo].[$table] WHERE $where ");
          $sth-&gt;setFetchMode(PDO::FETCH_ASSOC);
          $sth-&gt;execute();
          $data = $sth-&gt;fetchAll();
          return $data;
      } catch (Exception $ex) {
          if(DEV_MODE === true){
              echo "The Error : " . $ex-&gt;getMessage() . "&lt;br /&gt;";
              echo "The Error in : " . $ex-&gt;getFile() . "&lt;br /&gt;";
              echo "Line : " . $ex-&gt;getLine() . "&lt;br /&gt;";
          } else {
              echo "[2003]The System has some error, Please contact with Administrator!";
          }
          die;
      }
  }
  </code></pre>