title: The if statmen is not working properly
body: <p>Hi guys I have really simpy code:</p>
  
  <pre><code>mysql_select_db("tierra") or die(mysql_error());
  
  $query= "SELECT DISTINCT `fecha` FROM inventarioStat WHERE `fecha` = '$timestamp'"; 
  $result = mysql_query($query) or die ("Error in query: $query " . mysql_error()); 
  $row = mysql_fetch_array($result); 
  $num_results = mysql_num_rows($result); 
  echo $row['fecha'];
  
  if ($row['fecha'] == $timestamp) { break;}
  else
  
  { 
  mysql_select_db("tierra") or die(mysql_error());
  if(isset($_POST["hiddenProducto"]) &amp;&amp; count($_POST['hiddenProducto'])&gt;0) {
  
      foreach($_POST["hiddenProducto"] as $key =&gt; $value) {
           "TOTAL:". $total = $value;
           "&lt;br&gt;";
           "Value:".$value = $_POST["total"][$key];
           "&lt;br&gt;";
           "idItem:".$idItem = $_POST['hiddenidItem'][$key];
           "&lt;br&gt;";
           "Nombre:".$nombre = $_POST['nombre'];
           "&lt;br&gt;";
           "Producto:".$producto = $_POST['hiddenProducto'][$key];
           "&lt;br&gt;";
           "Provedor:".$proveedor = $_POST['proveedor'][$key];
           "&lt;br&gt;";
           "undCaja:".$undCaja = $_POST['udCaja'][$key];
           "&lt;br&gt;";
           "sueltas:".$undCaja = $_POST['sueltas'][$key];
           "&lt;br&gt;";
           "formato:".$formato=$_POST['formato'][$key];
           "&lt;br&gt;";
           "cajas:".$cajas = $_POST['cajas'][$key];
           "&lt;br&gt;";
           "diferencia:".$diferencia = ($_POST['lastValue'][$key]) - $value;
           "&lt;br&gt;";
          $query = "INSERT INTO `inventarioStat` (fecha, localizacion, nombre, idItem, producto, proveedor, udCaja, formato, cajas, sueltas, total, diferencia) VALUES
                       ('$timestamp', '$localizacion','$nombre', '$idItem', '$producto', '$proveedor', '$undCaja', '$formato','$cajas', '$sueltas', '$value', '$diferencia')";
  
           mysql_query($query);
      }     
  
  echo "Hecho!";
    }
  
  } 
  
  
  ?&gt;
  </code></pre>
  
  <p>What bother me is the following part:</p>
  
  <pre><code>if ($row['fecha'] == $timestamp) { break;}
  </code></pre>
  
  <p>It simply doesn't work, Im trying to avoid the duplicated dates being inserted in the database
  but obviously something Im doing wrong.</p>