Agregar botón al final de un reporte que cambie el satus de una línea, no de todos los datos
Hola de nuevo, fíjate que tengo una duda, tengo el siguiente reporte al cual le agregue un botón al final con el cual quiero que cuando lo presionen cambie el status ha cerrado pero como hago para que afecte unicamente a la linea y no a todos los datos te adjunto los script que estoy utilizando
Gracias
<html>
<head>
<I><CENTER><H2><font color="#000080"> REPORTE</H2></CENTER></I></font>
<I><CENTER><H2><font color="#000080"> Reporte de Quejas</H2></I></font>
<br>
<br>
</head>
<body oncontextmenu="return false" onkeydown="return false">
<table>
<table border="1">
<tr>
<td><font color="red">PUESTO</td>
</font>
<td><font color="red">STATUS</td>
</font>
</tr>
<tr>
<?php
mysql_connect("localhost", "root", "");
mysql_selectdb("foro");
$res = mysql_query("SELECT * FROM foro WHERE status='Activo' order by 'fecha'");
while ($registro = mysql_fetch_array($res)) {
?>
<tr>
<td><?php echo $registro["puesto"]; ?></td>
<td><?php echo $registro["status"]; ?></td>
<td><FORM ACTION="conec.php" METHOD=POST ENCTYPE="TEXT/PLAIN"><INPUT TYPE="submit"VALUE="Cerrar">
</FORM></td>
<?php
}
mysql_free_result($res);
mysql_close($conexion);
?>
</tr>
</table>
</center>
</html>
</head>
actualizacion
<?
$status2 = 'Cerrado';
$link = mysql_connect("localhost", "root", "");
mysql_selectdb("foro", $link);
$res = mysql_query("UPDATE foro Set status = '$status2' WHERE pid = '$ID'", $link);
//if (mysql_affected_rows($link) != 1) {echo "<H1> error </H1>"; exit;}
?>
<SCRIPT LANGUAGE="JavaScript">
location.href="reporte.php";
</SCRIPT>
Gracias
<html>
<head>
<I><CENTER><H2><font color="#000080"> REPORTE</H2></CENTER></I></font>
<I><CENTER><H2><font color="#000080"> Reporte de Quejas</H2></I></font>
<br>
<br>
</head>
<body oncontextmenu="return false" onkeydown="return false">
<table>
<table border="1">
<tr>
<td><font color="red">PUESTO</td>
</font>
<td><font color="red">STATUS</td>
</font>
</tr>
<tr>
<?php
mysql_connect("localhost", "root", "");
mysql_selectdb("foro");
$res = mysql_query("SELECT * FROM foro WHERE status='Activo' order by 'fecha'");
while ($registro = mysql_fetch_array($res)) {
?>
<tr>
<td><?php echo $registro["puesto"]; ?></td>
<td><?php echo $registro["status"]; ?></td>
<td><FORM ACTION="conec.php" METHOD=POST ENCTYPE="TEXT/PLAIN"><INPUT TYPE="submit"VALUE="Cerrar">
</FORM></td>
<?php
}
mysql_free_result($res);
mysql_close($conexion);
?>
</tr>
</table>
</center>
</html>
</head>
actualizacion
<?
$status2 = 'Cerrado';
$link = mysql_connect("localhost", "root", "");
mysql_selectdb("foro", $link);
$res = mysql_query("UPDATE foro Set status = '$status2' WHERE pid = '$ID'", $link);
//if (mysql_affected_rows($link) != 1) {echo "<H1> error </H1>"; exit;}
?>
<SCRIPT LANGUAGE="JavaScript">
location.href="reporte.php";
</SCRIPT>
1 respuesta
Respuesta de davidcortesb
1