title: How to UPDATE all rows in SQL with one query?
body: <p>I have an existing DATABASE of Prestashop, and I have made small modifications to it. I made a separate PHP page which gets data from table with products (only the data i need) and shows me all products that ARE IN THAT TABLE, one after another. I also have a function which updates a products, on which i press EDIT.</p>
  
  <p>So, in a simple words i can update a single product per click. But now I have about 220 products, and in order to update a value (price) for each product, now, i must click EDIT for each product, 220 times.</p>
  
  <p>Is there a way to make a query in order to update all rows after i click a BUTTON?  </p>
  
  <p><strong>Bellow I will show you some basic parts from my script:</strong></p>
  
  <p><em><strong>GET function:</em></strong></p>
  
  <pre><code>&lt;?php
  
  $strSQL = "SELECT * FROM ps_product";
  $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
  
  while($objResult = mysql_fetch_array($objQuery))
  {
  ?&gt;
  &lt;!-- HTML CODE --&gt;
  &lt;? } ?&gt;
  </code></pre>
  
  <p><em><strong>UPDATE function for each product</em></strong></p>
  
  <pre><code>if($_POST["hdnCmd"] == "Update")
  {
      $strSQL = "UPDATE ps_product_shop SET ";
      $strSQL .="id_product = '".$_POST["txtEditid_product"]."' ";
      $strSQL .=",price = '".$_POST["txtEditprice"]."' ";
      $strSQL .=",active = '".$_POST["txtEditactive"]."' ";
      $strSQL .="WHERE id_product = '".$_POST["hdnEditid_product"]."' ";
      $objQuery = mysql_query($strSQL);
      if(!$objQuery)
      {
          echo "Error Update [".mysql_error()."]";
      }
  
  }
  </code></pre>
  
  <p><strong>$_POST["hdnEditid_product]</strong> is the product id value that is taken from table.</p>
  
  <hr>
  
  <p><strong>Please help me to understand how to make a similar **</strong><em>UPDATE function</em><strong>** **which will update all rows (product_id) at once?</strong></p>
  
  <p>As an example i must work around this code:</p>
  
  <pre><code>if($_POST["UPDATEALLPRODUCTS"] == "Update")
  {
      $strSQL = "UPDATE ps_product_shop SET ";
      $strSQL .=",price = '".$_POST["txtEditprice"]."' ";
      $strSQL .="WHERE id_product = '".$_POST["hdnEditid_product"]."' ";
      $objQuery = mysql_query($strSQL);
      if(!$objQuery)
      {
          echo "Error Update [".mysql_error()."]";
      }
  }
  </code></pre>
  
  <p>but what I must add/change here:</p>
  
  <pre><code>$strSQL .="WHERE id_product = '".$_POST["hdnEditid_product"]."' ";
  </code></pre>