We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
Subscribe: RSS
  • Quote from: doze at Sep 07, 2006, 06:57 AM

    If I go to page 2 in the courses table when 25 items are listed per page and then select 50 to be listed, I get "no industries found" message.

    Hmmmm, that does appear to causes issues. If you select say 10 per page, then go to page 2 and select to view more per page than the actual number of records, it shows the error. This does not occur if you’re on page 1 sad

    UPDATE: The problem appears to be triggered whenever you chose to display more records per page, than there is remaining (not total like I thought before) from any page but the first one.

    eg. If I have 100 records, and I choose to show 25 records per page, I’ll have 4 pages. If I got to page two, I’ll still have 3 pages left (75 records). If I select to show 50 records per page, no problems, but 100 per page will cause issue.

    If I use the same 100 record example and go to page 3, so I have 1 page (25 records) left, and now select 50 per page, I’ll get the error.

    Maybe because it can’t populate the 50 records on the page from the current position in the table?
      [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
      Admin Sandbox Login: sandbox Password: castle
    • Hello OpenGeek,
      I need from your help.
      I want to migrate an existing page to ModX using MakeTable.
      My problem is that I do not understand how to do this. huh
      Thank you for your help.

      You can see the current page in www.cerianipublicidad.com.ar/web/guia_pymes_avisos.php
      The PHP code of the page is the following:
      //inicializo el criterio y recibo cualquier cadena que se desee buscar
      $criterio = "";
      if ($_GET["criterio"]!=""){
          $txt_criterio = $_GET["criterio"];
          $criterio = " AND empresas.empresa like '%" . $txt_criterio . "%'";
      //Limito la busqueda
      $TAMANO_PAGINA = 25;
      //examino la página a mostrar y el inicio del registro a mostrar
      $pagina = $_GET["pagina"];
      if (!$pagina) {
          $inicio = 0;
      else {
          $inicio = ($pagina - 1) * $TAMANO_PAGINA;
      //conecto con la base de datos
      $conn = mysql_connect("localhost","user","pass");
      //miro a ver el número total de campos que hay en la tabla con esa búsqueda
      $ssql = "select * from empresas,rubros WHERE rubros.Id_rubro=empresas.Id_rubro " . $criterio . " ORDER BY rubros.rubro,empresas.empresa";
      $rs = mysql_query($ssql,$conn);
      $num_total_registros = mysql_num_rows($rs);
      //calculo el total de páginas
      $total_paginas = ceil($num_total_registros / $TAMANO_PAGINA);
      //pongo el número de registros total, el tamaño de página y la página que se muestra
      echo "<div align='center'><b>";
      echo "Hay " . $num_total_registros . " avisos registrados / ";
      echo "Mostrando la página " . $pagina . " de " . $total_paginas . "";
      echo "</div></b><br>";
      //construyo la sentencia SQL
      $ssql = "select * from empresas,rubros WHERE rubros.Id_rubro=empresas.Id_rubro " . $criterio . " order by rubros.rubro,empresas.empresa limit " . $inicio . "," . $TAMANO_PAGINA;
      $rs = mysql_query($ssql);
      while ($fila = mysql_fetch_object($rs)){
      $Id_empresa = $fila->cod_emp;
      $la_empresa = $fila->empresa;
      $el_fono = $fila->telefono;
      $el_mail = $fila->email;
      $el_rubro = $fila->rubro;
      if ($ultimorubro != $el_rubro ) {
        echo "<tr><td colspan='3' bgcolor='#CCCCCC'><b>$el_rubro</b></td></tr>";
        echo "<tr bgcolor='#FFFFFF'>";
        echo "<td><b>$la_empresa</b></td>";
        echo "<td><div align='right'>$el_fono</div></td>";
        if ($el_mail != "") {
          echo "<td><a href='mailto:$el_mail'>Em@il</a></td>";
        } else {
          echo "<td></td>";
        echo "</tr>";
        $ultimorubro = $el_rubro;
      } else {
        echo "<tr bgcolor='#FFFFFF'>";
        echo "<td><b>$la_empresa</b></td>";
        echo "<td><div align='right'>$el_fono</div></td>";
        if ($el_mail != "") {
          echo "<td><a href='mailto:$el_mail'>Em@il</a></td>";
        } else {
          echo "<td></td>";
        echo "</tr>";
      print ("</table><br>");
      //cerramos el conjunto de resultado y la conexión con la base de datos
      //muestro los distintos índices de las páginas, si es que hay varias páginas
      echo "<div align='center'><b>";
      if ($total_paginas > 1){
          for ($i=1;$i<=$total_paginas;$i++){
             if ($pagina == $i)
                //si muestro el índice de la página actual, no coloco enlace
                echo $pagina . " ";
                //si el índice no corresponde con la página mostrada actualmente, coloco el enlace para ir a esa página
                echo "<a href='guia_pymes_avisos.php?pagina=" . $i . "&criterio=" . $txt_criterio . "'>" . $i . "</a> ";
      echo "</div></b>";
      print("<form action='guia_pymes_avisos.php' method='get'>
      Buscar empresa:
      <input type='text' name='criterio' size='22' maxlength='150'>
      <input type='submit' value='Buscar'>