Como puedo guardar lo que se edita, ya que cuando edito no queda guardado en bd.
La idea es editar los tres campos, nombre, edad y telefono.
La edicion funciona con solo hacer clic en el nombre, edad y telefono todo en tiempo real, sin cambiar de pagina. Existe alguna forma mas facil de hacer esto eso.
Este es el codigo.
Código PHP:
Ver original<?php
include("conex.php");
$link = Conectarse();
?>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("div.editnombre").click(function() {
if ($(this).children('input').length == 0) {
var inputbox = "<input type='text' class='inputbox' value=\""+$(this).text()+"\">";
$(this).html(inputbox);
$("input.inputbox").focus();
$("input.inputbox").blur(function() {
var value = $(this).val();
$(".editnombre").text(value);
});
}
});
});
</script>
<?php
$conn = "select * from ingreso";
{
$id = $row[id];
$nombre = $row[nombre];
$edad = $row[edad];
$telefono = $row[telefono];
echo "ID: $id<br>";
echo "Nombre: $nombre<br>";
$editar = "UPDATE ingreso SET nombre = 'inputbox' WHERE id = $id";
echo "Edad: $edad<br>";
echo "Telefono: $telefono<br><br>";
}
?>
<div class="editnombre">Modificar el texto</div>
Aqui la base de datos a editar, en MySQL 5