les dejo el codigo que utilizo
Código PHP:
<?php
$sql = "select * from reserva where estado_reser like 'POR CANCELAR'";
$resultados = mysql_query($sql);
if(mysql_num_rows($resultados)>0){
?>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>N° BOL.</th>
<th>NOMBRE</th>
<th>APELLIDOS</th>
<th>DNI</th>
<th>DESTINO</th>
<th>ESTADO</th>
<th>OPCIONES</th>
</tr>
</thead>
<tbody>
<?php
while ($fila = mysql_fetch_array($resultados)) {
echo "<tr>";
$c=$fila['cod_reser'];
$bol=$fila['n_bol_reser'];
echo "<input id='c' class='form-control hidden' value='$c'>";
echo "<input id='bol' class='form-control hidden' value='$bol'>";
echo "<td>" . $bol . "</td>";
$d=$fila['CLIENTE_cod_clie'];
$sql=mysql_query("SELECT * FROM cliente WHERE cod_clie ='$d'");
$m=mysql_fetch_assoc($sql);
echo "<td>" . $m['nombre_clie'] . "</td>";
echo "<td>" . $m['apellidos_clie'] . "</td>";
echo "<td>" . $m['dni_clie'] . "</td>";
$de=$fila['DESTINO_cod_de'];
$sql2=mysql_query("SELECT * FROM destino WHERE cod_de ='$de'");
$d=mysql_fetch_assoc($sql2);
echo "<td>" . $d['ciudad_de'] . "</td>";
$sql=mysql_query("SELECT * FROM programacion WHERE id_prog ='".$fila['PROGRAMACION_id_prog']."'");
$p=mysql_fetch_assoc($sql);
echo "<td id='aa'>
<select id='pago' disabled='disabled' class='txt' style='display:none;'>
<option></option>
<option>POR CANCELAR</option>
<option>PAGADO</option>
</select>
<div id='npm' class='txt'>".$fila['estado_reser']."</div>
</td>";
echo "<td id='aa'>
<button id='canc' type='button' class='btn btn-sm btn-info' style='display:none;'><span class='glyphicon glyphicon-log-out'></span></button>
<button id='sa' type='button' class='btn btn-sm btn-success sw' style='display:none;' ><span class='glyphicon glyphicon-floppy-saved'></span></button>
<button id='ed' type='button' class='btn btn-sm btn-danger sw' ><span class='glyphicon glyphicon-pencil'></span></button>
</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<?php
}else{
echo "<p>No se encontro ningun resultado.</p>";
}
?>
Javascript
Código:
$(document).ready(function(){ $("#ed").click(function(e){ $('#ed').slideUp('normal'); $('#sa').fadeIn('normal'); $('#canc').slideDown('normal'); $('#pago').prop('disabled', false); $('#pago').fadeIn('normal'); $('#npm').slideUp('normal'); }); $("#canc").click(function(e){ $('#ed').slideDown('normal'); $('#sa').slideUp('normal'); $('#canc').slideUp('normal'); $('#pago').prop('disabled', true); $('#pago').slideUp('normal'); $('#npm').fadeIn('normal'); }); });