Hola gente, a ver si me pueden echar una mano por que ya no le encuentro mas vueltas.
hago una consulta a la base de datos y listo los resultados. Lo logico seria que para actualizar los datos abriera un formulario cargando estos datos, pero lo hago en el mismo paso.
Todo funciona bien, pero solo me actualiza el ultimo registro y no los anteriores.
A ver si alguien puede echarme una mano, ya he buscado y releído pero no lo puedo solucionar.
Código PHP:
Ver original//1. Crear conexión a la Base de Datos
if (!$conexion) {
}
//2. Seleccionar la Base de Datos a utilizar
if (!$seleccionar_bd) {
}
$seleccionar = mysql_query("SELECT * FROM playing_today"); if (!$seleccionar) {
die("Fallo en la seleccion de registro en la Base de Datos: " . mysql_error()); }
echo"
<form action='actualizar_player_price.php' method='POST'>
<table border=0 id=mytable cellspacing=0>
<tr class='spec'>
<th align=center width='20'>ID</th>
<th align=center>Player Name</th>
<th class='title'>Prev. Owed</th>
<th class='title'>Court Rental</th>
<th class='title'>Pala Rental</th>
<th class='title'>Beberage</th>
<th class='title'>Lesson</th>
<th class='title'>Pala Sale</th>
<th class='title'>Balls</th>
<th class='title'>Overgrip</th>
<th class='title'>Food</th>
<th class='title'>Other</th>
<th class='title'>Total</th>
<th class='title2'>Paid</th>
<th class='title2'>Curr. Owed</th>
<th class='title2'>Update</th>
<th class='title2'>Close</th>
</tr>
";
{
$po = $fila['prev_owed'];
$ct = $fila['court_price'];
$pr = $fila['pala_rental_price'];
$bb = $fila['beberage_price'];
$le = $fila['lesson_price'];
$ps = $fila['pala_sale_price'];
$ba = $fila['balls_price'];
$og = $fila['overgrip_price'];
$fo = $fila['food_price'];
$ot = $fila['other'];
$pd = $fila['paid'];
$rt = $fila['rest'];
$suma = $ct+$pr+$bb+$le+$ps+$ba+$og+$fo+$ot;
$rest = $suma-$pd;
$final = $rest+$po;
echo"
<tr class='spec' >
<td align=center width='20'>".$fila['personalID']."</td>
<td align=center width='170'>".$fila['first_name']." ".$fila['last_name']."</td>
<td align=center width='20'>".$fila['prev_owed']."</td>
<td align=center width='20'><input type='text' name='court_price' value='".$fila['court_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='pala_rental_price' value='".$fila['pala_rental_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='beberage_price' value='".$fila['beberage_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='lesson_price' value='".$fila['lesson_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='pala_sale_price' value='".$fila['pala_sale_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='balls_price' value='".$fila['balls_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='overgrip_price' value='".$fila['overgrip_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='food_price' value='".$fila['food_price']."' size=5 /></td>
<td align=center width='20'><input type='text' name='other' value='".$fila['other']."' size=5 /></td>";
echo "
<td align=center width='20'>";echo " ".$suma." "; echo"
<td align=center width='20'><input type='text' name='paid' value='".$fila['paid']."' size=5 /></td>
<td align=center width='20'>";echo " ".$final." "; echo"</td>
<td align=center width='20'><input type='submit'></td>
<td align=center width='20'><a href='#'>Close</a></td>
</tr>
";
$_SESSION['personalID'] = $fila['personalID'];
}
echo "</tabla></form>";