Código PHP:
mysqli_data_seek($result, 2);
$row2 = mysqli_fetch_row($result);
$id2=$row2[1];
$id_stock2=$row2[1];
$max_venta_real2=$row2[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc2="select id_stock,cantidad from stock where id_stock='".$id_stock2."'";
$rc2= mysqli_query($patricio,$sc2);
while ($fc2=mysqli_fetch_array($rc2))
{$c2=$fc2["cantidad"];
$cant2=$c2-$co2;}
$uco2="update stock set
cantidad='".$cant2."'
where id_stock='".$id_stock2."'";
mysqli_query($patricio,$uco2);
$uvo2="update ventas set
cantidad='".$co2."',
subtotal='".$subt2."'
where id_stock='".$id_stock2."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo2);
//echo 'unco2: '.$uco2.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 3);
$row3 = mysqli_fetch_row($result);
$id3=$row3[1];
$id_stock3=$row3[1];
$max_venta_real3=$row3[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc3="select id_stock,cantidad from stock where id_stock='".$id_stock3."'";
$rc3= mysqli_query($patricio,$sc3);
while ($fc3=mysqli_fetch_array($rc3))
{$c3=$fc3["cantidad"];
$cant3=$c3-$co3;}
$uco3="update stock set
cantidad='".$cant3."'
where id_stock='".$id_stock3."'";
mysqli_query($patricio,$uco3);
$uvo3="update ventas set
cantidad='".$co3."',
subtotal='".$subt3."'
where id_stock='".$id_stock3."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo3);
//echo 'unco3: '.$uco3.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 4);
$row4 = mysqli_fetch_row($result);
$id4=$row4[1];
$id_stock4=$row4[1];
$max_venta_real4=$row4[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc4="select id_stock,cantidad from stock where id_stock='".$id_stock4."'";
$rc4= mysqli_query($patricio,$sc4);
while ($fc4=mysqli_fetch_array($rc4))
{$c4=$fc4["cantidad"];
$cant4=$c4-$co4;}
$uco4="update stock set
cantidad='".$cant4."'
where id_stock='".$id_stock4."'";
mysqli_query($patricio,$uco4);
$uvo4="update ventas set
cantidad='".$co4."',
subtotal='".$subt4."'
where id_stock='".$id_stock4."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo4);
//echo 'unco4: '.$uco4.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 5);
$row5 = mysqli_fetch_row($result);
$id5=$row5[1];
$id_stock5=$row5[1];
$max_venta_real5=$row5[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc5="select id_stock,cantidad from stock where id_stock='".$id_stock5."'";
$rc5= mysqli_query($patricio,$sc5);
while ($fc5=mysqli_fetch_array($rc5))
{$c5=$fc5["cantidad"];
$cant5=$c5-$co5;}
$uco5="update stock set
cantidad='".$cant5."'
where id_stock='".$id_stock5."'";
mysqli_query($patricio,$uco5);
$uvo5="update ventas set
cantidad='".$co5."',
subtotal='".$subt5."'
where id_stock='".$id_stock5."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo5);
//echo 'unco5: '.$uco5.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 6);
$row6 = mysqli_fetch_row($result);
$id6=$row6[1];
$id_stock6=$row6[1];
$max_venta_real6=$row6[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc6="select id_stock,cantidad from stock where id_stock='".$id_stock6."'";
$rc6= mysqli_query($patricio,$sc6);
while ($fc6=mysqli_fetch_array($rc6))
{$c6=$fc6["cantidad"];
$cant6=$c6-$co6;}
$uco6="update stock set
cantidad='".$cant6."'
where id_stock='".$id_stock6."'";
mysqli_query($patricio,$uco6);
$uvo6="update ventas set
cantidad='".$co6."',
subtotal='".$subt6."'
where id_stock='".$id_stock6."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo6);
//echo 'unco6: '.$uco6.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 7);
$row7 = mysqli_fetch_row($result);
$id7=$row7[1];
$id_stock7=$row7[1];
$max_venta_real7=$row7[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc7="select id_stock,cantidad from stock where id_stock='".$id_stock7."'";
$rc7= mysqli_query($patricio,$sc7);
while ($fc7=mysqli_fetch_array($rc7))
{$c7=$fc7["cantidad"];
$cant7=$c7-$co7;}
$uco7="update stock set
cantidad='".$cant7."'
where id_stock='".$id_stock7."'";
mysqli_query($patricio,$uco7);
$uvo7="update ventas set
cantidad='".$co7."',
subtotal='".$subt7."'
where id_stock='".$id_stock7."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo7);
//echo 'unco7: '.$uco7.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 8);
$row8 = mysqli_fetch_row($result);
$id8=$row8[1];
$id_stock8=$row8[1];
$max_venta_real8=$row8[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc8="select id_stock,cantidad from stock where id_stock='".$id_stock8."'";
$rc8= mysqli_query($patricio,$sc8);
while ($fc8=mysqli_fetch_array($rc8))
{$c8=$fc8["cantidad"];
$cant8=$c8-$co8;}
$uco8="update stock set
cantidad='".$cant8."'
where id_stock='".$id_stock8."'";
mysqli_query($patricio,$uco8);
$uvo8="update ventas set
cantidad='".$co8."',
subtotal='".$subt8."'
where id_stock='".$id_stock8."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo8);
//echo 'unco8: '.$uco8.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 9);
$row9 = mysqli_fetch_row($result);
$id9=$row9[1];
$id_stock9=$row9[1];
$max_venta_real9=$row9[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc9="select id_stock,cantidad from stock where id_stock='".$id_stock9."'";
$rc9= mysqli_query($patricio,$sc9);
while ($fc9=mysqli_fetch_array($rc9))
{$c9=$fc9["cantidad"];
$cant9=$c9-$co9;}
$uco9="update stock set
cantidad='".$cant9."'
where id_stock='".$id_stock9."'";
mysqli_query($patricio,$uco9);
$uvo9="update ventas set
cantidad='".$co9."',
subtotal='".$subt9."'
where id_stock='".$id_stock9."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo9);
//echo 'unco9: '.$uco9.'<br>';
//------------------------------------------------------------------------------------------------------------------------------------------------------
mysqli_data_seek($result, 10);
$row10 = mysqli_fetch_row($result);
$id10=$row10[1];
$id_stock10=$row10[1];
$max_venta_real10=$row10[2];
//------------------------------------------------------------------------------------------------------------------------------------------------------
$sc10="select id_stock,cantidad from stock where id_stock='".$id_stock10."'";
$rc10= mysqli_query($patricio,$sc10);
while ($fc10=mysqli_fetch_array($rc10))
{$c10=$fc10["cantidad"];
$cant10=$c10-$co10;}
$uco10="update stock set
cantidad='".$cant10."'
where id_stock='".$id_stock10."'";
mysqli_query($patricio,$uco10);
$uvo10="update ventas set
cantidad='".$co10."',
subtotal='".$subt10."'
where id_stock='".$id_stock10."' AND max_venta_real='".$_POST["max_venta_real"]."'";
mysqli_query($patricio,$uvo10);
//echo 'unco10: '.$uco10.'<br>';
}};
//echo $id1.'<br>';
//echo $id_stock1.'<br>';
//echo $max_venta_real1.'<br>';
mysqli_free_result($result);
?>
<div align="center">VENTA REALIZADA</div>
<meta http-equiv="refresh" content="11;URL=../home.php">