title: Insert PDO Php - Error SQLSTATE [HY000]: General error -
body: <p>When I run this php file shows me the error <code>SQLSTATE [HY000]: General error</code>. Why?</p>
  
  <pre><code>function Gethotspots($db) {
      $regId = $_GET['regId'];
      $sql = $db-&gt;prepare("INSERT INTO notificaciones (regId) VALUES ('" . $regId . "')");
      $sql-&gt;execute();
  
      $i = 0;
  
      $pois = $sql-&gt;fetchAll(PDO::FETCH_ASSOC);
  
      if (empty($pois)) {
          $response["productos"] = array();
      }
      else {
          foreach ($pois as $poi) {
              $poi["actions"] = array();
  
              $response["productos"][$i] = $poi;
              $i++;
          }
      }
      return $response["productos"];
  }
  
  $dbhost = "localhost";
  $dbdata = "anuncios";
  $dbuser = "root";
  $dbpass = "";
  
  try {
      $db = new PDO("mysql:host=$dbhost; dbname=$dbdata", $dbuser, $dbpass, array(
              PDO::MYSQL_ATTR_INIT_COMMAND =&gt; "SET NAMES utf8"));
  
      $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
      $response = array();
  
      $response["productos"] = Gethotspots($db);
  
      if (empty($response["productos"])) {
          $response["errorCode"] = 20;
          $response["errorString"] = "Ningun producto encontrado.";
      } // if
      else {
          $response["errorCode"] = 0;
          $response["errorString"] = "Todo correcto";
      }
  
      $jsonresponse = json_encode($response);
      header('Access-Control-Allow-Origin: *');
  
      echo $jsonresponse;
  
      $db = null;
  } catch (PDOException $e) {
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>Thanks all!</p>