Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/05/2011, 07:49
oOalexOo
 
Fecha de Ingreso: mayo-2011
Mensajes: 4
Antigüedad: 13 años
Puntos: 0
Respuesta: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL r

Código:
<?php session_start();
  if (isset($_GET["order"])) $order = @$_GET["order"];
  if (isset($_GET["type"])) $ordtype = @$_GET["type"];

  if (isset($_POST["filter"])) $filter = @$_POST["filter"];
  if (isset($_POST["filter_field"])) $filterfield = @$_POST["filter_field"];
  $wholeonly = false;
  if (isset($_POST["wholeonly"])) $wholeonly = @$_POST["wholeonly"];

  if (!isset($order) && isset($_SESSION["order"])) $order = $_SESSION["order"];
  if (!isset($ordtype) && isset($_SESSION["type"])) $ordtype = $_SESSION["type"];
  if (!isset($filter) && isset($_SESSION["filter"])) $filter = $_SESSION["filter"];
  if (!isset($filterfield) && isset($_SESSION["filter_field"])) $filterfield = $_SESSION["filter_field"];

  if (isset($_GET["getimage"]))
  {
    $conn = connect();
    getimage(@$_GET["getimage"], @$_GET["field"]);
    exit;
  }
?>

<html>
<head>
<title>dae -- programa</title>
<meta name="generator" http-equiv="content-type" content="text/html">
<style type="text/css">
  body {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .bd {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .tbl {
    background-color: #FFFFFF;
  }
  a:link { 
    color: #FF0000;
    font-family: Arial;
    font-size: 12px;
  }
  a:active { 
    color: #0000FF;
    font-family: Arial;
    font-size: 12px;
  }
  a:visited { 
    color: #800080;
    font-family: Arial;
    font-size: 12px;
  }
  .hr {
    background-color: #336699;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:link {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:active {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:visited {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .dr {
    background-color: #FFFFFF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
  .sr {
    background-color: #FFFFCF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
</style>
</head>
<body>
<table class="bd" width="100%"><tr><td class="hr"><h2>Programas</h2></td></tr></table>
<?php
  $conn = connect();
  $showrecs = 10;
  $pagerange = 10;

  $a = @$_GET["a"];
  $recid = @$_GET["recid"];
  $page = @$_GET["page"];
  if (!isset($page)) $page = 1;

  $sql = @$_POST["sql"];

  switch ($sql) {
    case "insert":
      sql_insert();
      break;
    case "update":
      sql_update();
      break;
    case "delete":
      sql_delete();
      break;
  }

  switch ($a) {
    case "add":
      addrec();
      break;
    case "view":
      viewrec($recid);
      break;
    case "edit":
      editrec($recid);
      break;
    case "del":
      deleterec($recid);
      break;
    case "bajar":
      bajarp($recid);
      break;
    default:
      select();
      break;
  }

  if (isset($order)) $_SESSION["order"] = $order;
  if (isset($ordtype)) $_SESSION["type"] = $ordtype;
  if (isset($filter)) $_SESSION["filter"] = $filter;
  if (isset($filterfield)) $_SESSION["filter_field"] = $filterfield;
  if (isset($wholeonly)) $_SESSION["wholeonly"] = $wholeonly;

  mysql_close($conn);
?>

</body>
</html>

<?php function select()
  {
  global $a;
  global $showrecs;
  global $page;
  global $filter;
  global $filterfield;
  global $wholeonly;
  global $order;
  global $ordtype;


  if ($a == "reset") {
    $filter = "";
    $filterfield = "";
    $wholeonly = "";
    $order = "";
    $ordtype = "";
  }

  $checkstr = "";
  if ($wholeonly) $checkstr = " checked";
  if ($ordtype == "asc") { $ordtypestr = "desc"; } else { $ordtypestr = "asc"; }
  $res = sql_select();
  $count = sql_getrecordcount();
  if ($count % $showrecs != 0) {
    $pagecount = intval($count / $showrecs) + 1;
  }
  else {
    $pagecount = intval($count / $showrecs);
  }
  $startrec = $showrecs * ($page - 1);
  if ($startrec < $count) {mysql_data_seek($res, $startrec);}
  $reccount = min($showrecs * $page, $count);
?>
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr><td>Tabla: programa</td></tr>
<tr><td>Programas Mostrados <?php echo $startrec + 1 ?> - <?php echo $reccount ?> de <?php echo $count ?></td></tr>
</table>
<hr size="1" noshade>
<form action="programa.php" method="post">
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><b>Filtro</b>&nbsp;</td>
<td><input type="text" name="filter" value="<?php echo $filter ?>"></td>
<td><select name="filter_field">
<option value="">Todos los campos</option>
<option value="<?php echo "Clave" ?>"<?php if ($filterfield == "Clave") { echo "selected"; } ?>><?php echo htmlspecialchars("Clave") ?></option>
<option value="<?php echo "Asignatura" ?>"<?php if ($filterfield == "Asignatura") { echo "selected"; } ?>><?php echo htmlspecialchars("Asignatura") ?></option>
<option value="<?php echo "Escuela" ?>"<?php if ($filterfield == "Escuela") { echo "selected"; } ?>><?php echo htmlspecialchars("Escuela") ?></option>
<option value="<?php echo "Nivel" ?>"<?php if ($filterfield == "Nivel") { echo "selected"; } ?>><?php echo htmlspecialchars("Nivel") ?></option>
<option value="<?php echo "Inicio" ?>"<?php if ($filterfield == "Inicio") { echo "selected"; } ?>><?php echo htmlspecialchars("Inicio") ?></option>
<option value="<?php echo "Fin" ?>"<?php if ($filterfield == "Fin") { echo "selected"; } ?>><?php echo htmlspecialchars("Fin") ?></option>
</select></td>
<td><input type="checkbox" name="wholeonly"<?php echo $checkstr ?>>Palabra completa</td>
</td></tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="action" value="Filtrar"></td>
<td><a href="programa.php?a=reset">Resetear Filro</a></td>
</tr>
</table>
</form>
<hr size="1" noshade>
<?php showpagenav($page, $pagecount); ?>
<br>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="100%">
<tr>
<td class="hr">&nbsp;</td>
<td class="hr">&nbsp;</td>
<td class="hr">&nbsp;</td>
<td class="hr"><a class="hr" href="programa.php?order=<?php echo "Clave" ?>&type=<?php echo $ordtypestr ?>"><?php echo htmlspecialchars("Clave") ?></a></td>
<td class="hr"><a class="hr" href="programa.php?order=<?php echo "Asignatura" ?>&type=<?php echo $ordtypestr ?>"><?php echo htmlspecialchars("Asignatura") ?></a></td>
<td class="hr"><a class="hr" href="programa.php?order=<?php echo "Escuela" ?>&type=<?php echo $ordtypestr ?>"><?php echo htmlspecialchars("Escuela") ?></a></td>
<td class="hr"><a class="hr" href="programa.php?order=<?php echo "Nivel" ?>&type=<?php echo $ordtypestr ?>"><?php echo htmlspecialchars("Nivel") ?></a></td>
<td class="hr"><a class="hr" href="programa.php?order=<?php echo "Inicio" ?>&type=<?php echo $ordtypestr ?>"><?php echo htmlspecialchars("Inicio") ?></a></td>
<td class="hr"><a class="hr" href="programa.php?order=<?php echo "Fin" ?>&type=<?php echo $ordtypestr ?>"><?php echo htmlspecialchars("Fin") ?></a></td>
<td class="hr"><?php echo "Archivo" ?></td>
</tr>
<?php
  for ($i = $startrec; $i < $reccount; $i++)
  {
    $row = mysql_fetch_assoc($res);
    $style = "dr";
    if ($i % 2 != 0) {
      $style = "sr";
    }
?>
<tr>
<td class="<?php echo $style ?>"><a href="programa.php?a=view&recid=<?php echo $i ?>">Ver</a></td>
<td class="<?php echo $style ?>"><a href="programa.php?a=edit&recid=<?php echo $i ?>">Modificar</a></td>
<td class="<?php echo $style ?>"><a href="programa.php?a=del&recid=<?php echo $i ?>">Borrar</a></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["Clave"]) ?></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["Asignatura"]) ?></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["Escuela"]) ?></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["Nivel"]) ?></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["Inicio"]) ?></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["Fin"]) ?></td>
<td class="<?php echo $style ?>"><a href="programa.php?a=bajar&recid=<?php echo $i ?>">Bajar</a></td>


</tr>
<?php
  }
  mysql_free_result($res);
?>
</table>
<br>
<?php showpagenav($page, $pagecount); ?>
<?php } ?>

<?php function showrow($row, $recid)
  {
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="50%">
<tr>
<td class="hr"><?php echo htmlspecialchars("Clave")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["Clave"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("Asignatura")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["Asignatura"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("Escuela")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["Escuela"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("Nivel")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["Nivel"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("Inicio")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["Inicio"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("Fin")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["Fin"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("Archivo")."&nbsp;" ?></td>
<td class="dr"><?php echo outimage($recid, "Archivo", "", "", "") ?></td>
</tr>
</table>
<?php } ?>


 ?>
continua...