php - sql syntax error with pro statement inserting row -


i using following code insert row in database. error

{"error":"sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'show) values('a e jewelers','quintin','schmidt','131 south rolling meadows dr.',' @ line 1"} 

here query

xxx/webservice/api.php?action=addstore&name=a%20e%20jewelers&firstname=quintin&lastname=schmidt&address=131%20south%20rolling%20meadows%20dr.&city=fond%20du%20lac&state=wi&country=usa&zip=54935&phone=(920)%20933%203601%0a&fax=(920)%20486-1734&email=diadori@aejewelers.com&latitude=43.775931&longitude=-88.482894&website=www.aejewelers.com&show=1      function addstore()      {         $name = trim($_request['name']);         $firstname = trim($_request['firstname']);         $lastname  = trim($_request['lastname']);         $address = trim($_request['address']);         $city = trim($_request['city']);         $state = trim($_request['state']);         $country = trim($_request['country']);         $zip = trim($_request['zip']);         $phone = trim($_request['phone']);         $fax = trim($_request['fax']);         $email = trim($_request['email']);         $latitude = trim($_request['latitude']);                 $longitude = trim($_request['longitude']);               $website = trim($_request['website']);               $show = 1;                return $show;         $insert_id = 0;         try {             $conn = $this->getdbconnection();             $statement = $conn->prepare('insert stores( name, firstname, lastname, address, city, state, country, zip, phone, fax, email, latitude,longitude, website,show) values(:name,:firstname,:lastname,:address,:city,:state,:country,:zip,:phone,:fax, :email, :phone, :zip)');              $statement->bindparam(':name',      $name, pdo::param_str);             $statement->bindparam(':firstname', $firstname, pdo::param_str);             $statement->bindparam(':lastname' , $lastname, pdo::param_str);             $statement->bindparam(':address',   $address, pdo::param_str);             $statement->bindparam(':city',      $city, pdo::param_str);             $statement->bindparam(':state',     $state, pdo::param_str);             $statement->bindparam(':country',   $country, pdo::param_str);             $statement->bindparam(':zip',       $zip, pdo::param_str);             $statement->bindparam(':phone',     $phone, pdo::param_str);             $statement->bindparam(':fax'    ,   $fax, pdo::param_str);             $statement->bindparam(':email'    , $email, pdo::param_str);             $statement->bindparam(':latitude' , $latitude, pdo::param_str);             $statement->bindparam(':longitude', $longitude, pdo::param_str);             $statement->bindparam(':website'  , $website, pdo::param_str);             $statement->bindparam(':show'     , $show, pdo::param_int);              $statement->execute();              $insert_id = $conn->lastinsertid();              $conn = null;         } catch(pdoexception $e) {             throw $e;         }          return $insert_id;     } 

replace column name show `show`

insert stores(       name, firstname, lastname, address, city, state,       country, zip, phone, fax, email, latitude,longitude,       website,`show`) values (:name,:firstname,:lastname,:address,:city,      :state,:country,:zip,:phone,:fax, :email,       :phone, :zip)' 

the word show keyword in sql


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -