ACTUALIZAR REGISTROS EN UN SOLO ARCHIVO O MAXIMO DOS ARCHIVOS PHP
Publicado por mauricio (1 intervención) el 24/03/2021 20:49:23
Buenas tardes,
estoy intentando realizar un botón actualizar en un solo archivo php, para evitar enviarlos a otro formulario.
Como se ve a continuación solo ay una función en otro archivo que es la conexión, como puedo realizar la actualización en el mismo archivo?

estoy intentando realizar un botón actualizar en un solo archivo php, para evitar enviarlos a otro formulario.
Como se ve a continuación solo ay una función en otro archivo que es la conexión, como puedo realizar la actualización en el mismo archivo?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
include("funciones.php");
if($_REQUEST)
{
$xidvendedor = $_REQUEST['xidvendedor'];
//$xcodplanilla = $_REQUEST['xcodplanilla'];
$conexionx=Conectar();
$selected=SeleccionDB();
//visitas por vendedor wenco
$strSQL10="SELECT nombre_usu from [DBTELEPEDIDO].dbo.tusuarios where IdUsuario=". $xidvendedor;
$cursor10 = mssql_query($strSQL10,$conexionx);
$xnombre=mssql_result($cursor10,0,0);
//pa ver al usuario p
$strSQLk="select CodVendedorWenco from tUsuarios where idusuario=" .$xidvendedor ;
$cursork = mssql_query($strSQLk,$conexionx);
$xcodvendedorwenco=mssql_result($cursork,0,0 );
//CUOTA POR VENDEDOR, TOTAL CARTERA DE CLIENTES
$strSQL6="SELECT CONVERT(numeric(10,2),sum(totchd)) from [025bdcomun].dbo.maecli where cestado='V' and cvende='" . $xcodvendedorwenc$
//echo $strSQL6;
$cursor6 = mssql_query($strSQL6,$conexionx);
$xcuotat=mssql_result($cursor6,0,0);
//EJEMPLO
$strSQL9="SELECT * FROM [DBTELEPEDIDO].dbo.tbcuotapro where codvend='" . $xcodvendedorwenco . "'";
//echo $strSQL9;
$cursor9 = mssql_query($strSQL9,$conexionx);
$xproduct=mssql_result($cursor9,0,0);
}
?>
<?php
//PROBANDO SI ACTUALIZA
if(isset($_POST['submit'])){
$id = (int)$_POST['id'];
$cuota= $_POST['cuota'];
$strSQL10="UPDATE [DBTELEPEDIDO].dbo.tbcuotapro SET cuotapro='" . $cuota. "' WHERE idcodpro=".$id;
$update=mssql_query($strSQL1O,$conexionx);
<html>
<body>
<div class="ibox-content">
<table class="table table-bordered">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<tr bgcolor="BLUE">
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>ID</FONT></th>
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>CODIGO</FONT></th>
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>PRODUCTO</FONT></th>
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>PRECIO</FONT></th>
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>CUOTA</FONT></th>
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>TOTAL</FONT></th>
<th bgcolor=\"#17676c\" ><FONT SIZE='1' color='white'>OPERACION</FONT></th>
</tr>
<?php while($row= mssql_fetch_array($cursor9)){ ?>
<tr>
<td><FONT SIZE='1'> <input type="text" value="<? echo $row[0];?>" name="id"<? echo $row[0]; ?> <$
<td><FONT SIZE='1'> <? echo $row[2]; ?> </FONT></td>
<td><FONT SIZE='1'> <? echo $row[3]; ?> </FONT></td>
<td><FONT SIZE='1'> <input type="text" value="<? echo $row[5]->precio;?>" name="precio"></FONT><$
<td><FONT SIZE='1'> <input type="text" value="<? echo $row[6]->cuota;?>" name="cuota"></FONT></t$
<td><FONT SIZE='1'> <? echo $row[5]+ $row[6]; ?> </FONT></td>
<td><FONT SIZE='1'> <input type="submit" value="Actualizar" name="submit"> </FONT></td>
</tr>
<?php } mssql_free_result($cursor9); ?>
</form>
</table>
</div>
</html>
</body>
</html>

Valora esta pregunta


0