recorrer arreglo con prev(),next(),end()
Publicado por zendi (12 intervenciones) el 06/07/2012 01:49:25
Buenas noche a todos. Por favor ¿como haria para utilizar prev(),next() y end() en este codigo.
Nota: en negrita esta el codigo.
$resultado1 = "SELECT deuda.cedula,deuda.fecha,propietarios.nroapto,SUM(monto) AS total FROM propietarios,deuda WHERE propietarios.nroapto = deuda.nroapto GROUP BY propietarios.nroapto,deuda.cedula,deuda.fecha ORDER BY nroapto";
$resultado = @pg_query($connect,$resultado1);
echo"<table border='1' bordercolor='#00CC99' bgcolor='#99CC00' align='center'>
</tr></table> ";
while ($seleccionado =@pg_fetch_array($resultado)):
$cedula = $seleccionado['cedula'];
$fecha = $seleccionado['fecha'];
$nroapto = $seleccionado['nroapto'];
$monto = $seleccionado['total'];
$anio = substr($fecha,0,4);
$mes = substr($fecha,5,2);
$dia = substr($fecha,8,2);
echo"<tr>
<tr><td width='50'><input type='text' value='$cedula' name='cedula' readonly='true' valign='middle'></td>
<td width='50'><input type='text' value='$dia"."/"."$mes"."/"."$anio' readonly='true' name='fecha'></td>
<td><input type='text' value='$nroapto' name='nroapto' readonly='true'></td>
<td width='50'><input type='text' value='$monto' size='8' readonly='true' name='deuda' align='right'></td>
</tr>";
endwhile;
echo "-><table><tr><td>".current($resultado1)."<br />";
echo "-> ".next($resultado1)."<br />";
echo "-> ".current($resultado1)."<br />";
echo "-> ".prev($resultado1)."<br />";
ya lo he corrido pero me arroja estos Warnings:
Warning: current() [function.current]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 105
->
Warning: next() [function.next]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 106
->
Warning: current() [function.current]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 107
->
Warning: prev() [function.prev]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 108
->
Nota: en negrita esta el codigo.
$resultado1 = "SELECT deuda.cedula,deuda.fecha,propietarios.nroapto,SUM(monto) AS total FROM propietarios,deuda WHERE propietarios.nroapto = deuda.nroapto GROUP BY propietarios.nroapto,deuda.cedula,deuda.fecha ORDER BY nroapto";
$resultado = @pg_query($connect,$resultado1);
echo"<table border='1' bordercolor='#00CC99' bgcolor='#99CC00' align='center'>
</tr></table> ";
while ($seleccionado =@pg_fetch_array($resultado)):
$cedula = $seleccionado['cedula'];
$fecha = $seleccionado['fecha'];
$nroapto = $seleccionado['nroapto'];
$monto = $seleccionado['total'];
$anio = substr($fecha,0,4);
$mes = substr($fecha,5,2);
$dia = substr($fecha,8,2);
echo"<tr>
<tr><td width='50'><input type='text' value='$cedula' name='cedula' readonly='true' valign='middle'></td>
<td width='50'><input type='text' value='$dia"."/"."$mes"."/"."$anio' readonly='true' name='fecha'></td>
<td><input type='text' value='$nroapto' name='nroapto' readonly='true'></td>
<td width='50'><input type='text' value='$monto' size='8' readonly='true' name='deuda' align='right'></td>
</tr>";
endwhile;
echo "-><table><tr><td>".current($resultado1)."<br />";
echo "-> ".next($resultado1)."<br />";
echo "-> ".current($resultado1)."<br />";
echo "-> ".prev($resultado1)."<br />";
ya lo he corrido pero me arroja estos Warnings:
Warning: current() [function.current]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 105
->
Warning: next() [function.next]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 106
->
Warning: current() [function.current]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 107
->
Warning: prev() [function.prev]: Passed variable is not an array or object in C:\wamp\www\tesis1\cierredeuda.php on line 108
->
Valora esta pregunta


0