title: How to check whether mysql update query is successful or not?
body: <pre><code>function insertNewBidPrice($code, $newBidPrice)
  {
    global $conn;
    $sql = "update auctionitem set highestbid=$newBidPrice where code=$code";
    //echo $sql;
    if($conn-&gt;query($sql))
    {
      return 1;
    }
    else
    {
      require 0;
    }
  }
  </code></pre>
  
  <p>I have this php fuction that results 0 all time although update query successfully update the table.</p>
  
  <p>I use PDO.</p>
  
  <pre><code>$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  </code></pre>