GRACIAS A FRANCO HE OBTENIDO ESTE CODIGO... LE HE INTENTADO HACER LAS VALIDACIONES PERO NADA...
<html>
<Head>
<style type="text/css">
a.p:link { color: #0066FF; text-decoration: none; }
a.p:visited { color: #0066FF; text-decoration: none; }
a.p:active { color: #0066FF; text-decoration: none; }
a.p:hover { color: #0066FF; text-decoration: underline; }
a.ord:link { color: #000000; text-decoration: none; }
a.ord:visited { color: #000000; text-decoration: none; }
a.ord:active { color: #000000; text-decoration: none; }
a.ord:hover { color: #000000; text-decoration: underline; }
</style>
</Head>
<body>
<div align="center"><strong><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Paginación de Resultados de la consulta SQL (sobre DB )<br><br> </font></strong> </div>
<hr noshade style="color:CC6666;height:1px"></Hr>
<p> CONSULTA DE ALUMNOS</p>
<hr noshade style = "color:CC6666;height:1px" ></hr>
<FORM METHOD="post"><br>
Seleccione Grupo: <br>
<select name="Curso">
<option value="1">Php</option>
<option value="2">Visual</option>
<option value="3">Excel</option>
<option value="4">Winword</option>
</select><br>
<input type="text" name="codigo" value="" />
<br>
<input type="radio" name="radio1" value="Por_codigo">Codigo <br>
<input type="radio" name="radio2" value="all">Todos <br>
<input type="submit" name="operar">
</form>
<?php
if ($_REQUEST['radio1']){
switch($_REQUEST['radio1']){
case 'Por_codigo':
$codigo=$_POST['codigo'];
$conexion=mysql_connect("localhost","root","") or die("Problemas en la conexion");
mysql_select_db("basedatos",$conexion) or die("Problemas en la selección de la base de datos");
$result = mysql_query("SELECT * FROM php,visual,excel,winword WHERE codigo ='$codigo'") or die("Error SQL excel: ".mysql_error());
$result_cantidad = mysql_num_rows($result);
break;
switch($_REQUEST['radio2']){
case 'all':
if($_REQUEST['Curso']){
switch($_REQUEST['Curso']){
case 1: $tabla = 'php';
$sql = "SELECT codigo,nombre,Email,pago1,pago2,pago3,pago4 FROM $tabla";
$conexion=mysql_connect("localhost","root","") or die("Problemas en la conexion");
mysql_select_db("fundabol",$conexion) or die("Problemas en la selección de la base de datos");
$result = mysql_query($sql, $conexion)or die("Error trayendo la informacion de la base de datos");
$result_cantidad = mysql_num_rows($result);
break;
case 2: $tabla = 'visual';
$sql = "SELECT codigo,nombre,Email,pago1,pago2,pago3,pago4 FROM $tabla";
$conexion=mysql_connect("localhost","root","") or die("Problemas en la conexion");
mysql_select_db("fundabol",$conexion) or die("Problemas en la selección de la base de datos");
$result = mysql_query($sql, $conexion)or die("Error trayendo la informacion de la base de datos");
$result_cantidad = mysql_num_rows($result);
break;
case 3: $tabla = 'excel';
//aca se supone otra vez la apertura de la base y su respectivo codigo..??
break;
case 4: $tabla = 'winword';
//aca se supone otra vez la apertura de la base y su respectivo codigo..??
break;
}
}
$sql = "SELECT codigo,nombre,Email,pago1,pago2,pago3,pago4 FROM $tabla";
$conexion=mysql_connect("localhost","root","") or die("Problemas en la conexion");
mysql_select_db("fundabol",$conexion) or die("Problemas en la selección de la base de datos");
$result = mysql_query($sql, $conexion)or die("Error trayendo la informacion de la base de datos");
$result_cantidad = mysql_num_rows($result);
}
break;
}
//si la cantidad del resultado es cero
if($result_cantidad == 0){
echo "La base de datos está vacia";
}else{
//cosa importante, separar el codigo html del codigo php, permite una mejor vision
// y detectar problemas mucho mas facil.
?>
<table border='1'>
<tr>
<th>Codigo</th>
<th>Nombre</th>
<th>Email</th>
<th>Pago 1</th>
<th>Pago 2</th>
<th>Pago 3</th>
<th>Pago 4</th>
</tr>
<tr>
<? while($row = msql_fetch_assoc($result)){?>
<td><? echo $row['Codigo'] ?></td>
<td><? echo $row['Nombre'] ?></td>
<td><? echo $row['Email'] ?></td>
<td><? echo $row['Pago1'] ?></td>
<td><? echo $row['Pago2'] ?></td>
<td><? echo $row['Pago3'] ?></td>
<td><? echo $row['Pago4'] ?></td>
<?} ?>
</tr>
</table>
<?}
mysql_free_result($result);
mysql_close($conexion);
}
?>
</body>
</html>