Ver Mensaje Individual
  #6 (permalink)  
Antiguo 10/12/2009, 11:21
Avatar de ColdFusion
ColdFusion
 
Fecha de Ingreso: octubre-2008
Ubicación: Tocoa, Colon Honduras C.A.
Mensajes: 419
Antigüedad: 16 años, 4 meses
Puntos: 9
Respuesta: Ayuda con base de datos y PHP

pues mira asi trabaja
edit_inplace.php
Código PHP:
<?
$action 
$_REQUEST['action'];
if(
$action == 'editar_equipo') {
    
$old_value trim($_REQUEST['original_html']);
    
$new_value trim($_REQUEST['update_value']);
    
mysql_query ("UPDATE `tablaposiciones` SET `equipo`='$new_value' WHERE `equipo`='$old_value'") or die(mysql_error());
    echo 
$new_value;
}
if(
$action == 'editar_PJ') {
    
$old_value trim($_REQUEST['original_html']);
    
$new_value trim($_REQUEST['update_value']);
    
mysql_query ("UPDATE `tablaposiciones` SET `pj`='$new_value' WHERE `pj`='$old_value'") or die(mysql_error());
    echo 
$new_value;
}
if(
$action == 'editar_puntos') {
    
$old_value trim($_REQUEST['original_html']);
    
$new_value trim($_REQUEST['update_value']);
    
mysql_query ("UPDATE `tablaposiciones` SET `puntos`='$new_value' WHERE `puntos`='$old_value'") or die(mysql_error());
    echo 
$new_value;
}

?>
editar_equipos.php
Código PHP:
<?
$websites_query 
"SELECT * FROM tablaposiciones WHERE mostrar='Si' ORDER BY puntos DESC";
$rezultat mysql_query($websites_query);
while(
$ROW mysql_fetch_object($rezultat)){
echo 
'
<table class="entry">
<tr><td width="60">Equipo:</td><td><span class="equipo">'
$ROW->equipo '</span></td></tr>
<tr><td>PJ:</td><td><span class="PJ">' 
$ROW->pj '</span></td></tr>
<tr><td>Puntos:</td><td><span class="puntos">' 
$ROW->puntos '</span></td></tr>

</td></tr>'
;
echo 
'</table>';
}
?>
code.js
Código:
$(document).ready(function(){
	
	$(".equipo").editInPlace({
    	url: "edit_inplace.php",
    	params: "action=editar_equipo&ajax=yes",
    	field_type: "text",
    	bg_over: "#ccc"
  	});
  	$(".PJ").editInPlace({
    	url: "edit_inplace.php",
    	params: "action=editar_PJ&ajax=yes",
    	field_type: "text",
    	bg_over: "#ccc"
  	});
  	$(".puntos").editInPlace({
    	url: "edit_inplace.php",
    	params: "action=editar_puntos&ajax=yes",
    	field_type: "text",
    	bg_over: "#ccc"
  	});

});
usa el jquery.js
y el inplace.js

AYUDA!