I have the following code, which I have a while that repeats me N quantity of products purchased from a database, in a td I have a select that is filled with the total products in my database, selecting the one that I bought , the problem is that when you show the first record, you leave the cycle and you do not keep showing me the others.
while ($RowProd = mssql_fetch_array($RProd)) {
$options = &BuscarProds($RowProd['Modelo'],$RCab['Consignatario']);
$c++;
$trProd .= '<tr>
<td class="col-xs-1">
<input value="'.$c.'-'.$c2.'-'.$RCab['Consignatario'].'" type="text" class="form-control" readonly="readonly">
</td>
<td class="col-xs-2">
<select class="form-control">'.$Mercancia.'</select>
</td>
<td class="col-xs-2">
<input value="'.$RowProd["Descripcion"].'" type="text" name="Descripcion[]" class="form-control" readonly="readonly">
</td>
<td class="col-xs-1">
<input value="'.$RowProd["Cantidad"].'" id="cantidad" name="Cantidad[]" type="text" class="form-control">
</td>
<td class="col-xs-1">
<input value="'.$RowProd["Costo"].'" id="costo" name="Costo[]" type="text" class="form-control">
</td>
<td class="col-xs-1">
<input value="'.$RowProd["Total"].'" id="total" name="Total[]" type="text" class="form-control" readonly="readonly">
</td>
</tr>';
}
function &BuscarProds($code, $store)
{
static $Mercancia = '';
$Tienda = CargarTienda($store);
$CSQPR = consultar2("SELECT CodProd, Descrip FROM SAPROD ORDER BY CodProd",0,$Tienda);
while($rowT = mssql_fetch_array($CSQPR)){
if($rowT['CodProd']==$code){
$Mercancia .= '<option value="'.$code.'" selected>'.$code.'</option>';
}else{
$Mercancia .= '<option value="'.$rowT['CodProd'].'">'.$rowT['CodProd'].'</option>';
}
}
return $Mercancia;
}
The question is, I have 47 Products ... but in the while it only shows me the first record, it does not keep showing the others ... Any ideas?