Jump to content
Larry Ullman's Book Forums

asanti

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by asanti

  1. the markup is in my first post with the actual result. this is my complete .php file <?php require_once ('inc/db.php'); //include_once ('inc/funciones.php'); $display = 10; if (isset($_GET['p']) && is_numeric($_GET['p'])) { $pages = $_GET['p']; } else { $q = "SELECT COUNT(id_aviso) FROM avisos WHERE fecha_moderado IS NOT NULL ORDER BY fecha_creado DESC"; $r = @mysqli_query($dbc, $q); $row = @mysqli_fetch_array($r, MYSQLI_NUM); $records = $row[0]; if ($records > $display){ $pages = ($records % $display == 0) ? ($records/$display) : ceil($records/$display); } else { $pages = 1; } } if (isset($_GET['s']) && is_numeric($_GET['s'])){ $start = $_GET['s']; } else { $start= 0; } $q = "SELECT titulo, descripcion, DATE_FORMAT(fecha_creado, '%d %M, %Y') AS fc, id_aviso FROM avisos WHERE fecha_moderado IS NOT NULL ORDER BY fecha_creado DESC LIMIT $start, $display"; $r = @mysqli_query ($dbc, $q); $num = mysqli_num_rows($r); $foto = 'imagenes/fotos_avisos/random5.png'; while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)){ echo '<div class="media margin-none"> <a class="pull-left bg-inverse innerAll text-center" href="#"><img src="' . $foto . '" share_alt="" width="100"></a> <div class="media-body innerAll"> <h4 class="media-heading innerT"> <a href="' . sanitizarURL($row['titulo']) .'-da' . $row['id_aviso'] . '" class="text-inverse">' . substr($row['titulo'], 0, 60) . '</a> <span class="text-small pull-right"><i class="fa fa-fw fa-calendar-o"></i> ' . $row['fc'] . '</span></h4> <p>' . substr($row['descripcion'], 0, 80) . ' ...</p> <h4><span class="text-small"><i class="fa fa-fw fa-map-marker"></i> Capital Federal</span></h4> </div> </div> <div class="col-separator-h"></div>'; } echo ''; mysqli_free_result($r); mysqli_close($dbc); if ($pages > 1) { echo '<li>'; $current_page = ($start/$display) + 1; if($current_page != 1){ echo '<a href="convocatorias.php?s=' . ($start - $display) . '&p=' . $pages . '">Previous</a> '; } for($i = 1; $i <= $pages; $i++){ if($i != $current_page){ echo '<a href="convocatorias.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '">' . $i . '</a> '; } else { echo $i . ' '; } } if($current_page != $pages){ echo '<a href="convocatorias.php?s=' . ($start + $display) . '&p=' . $pages . '">Next</a>'; } echo '</li>'; } ?>
  2. thanks for your answer, the second point is clear. The first one i still don't get it. Suppose i have to manually insert users from another database to the actual one with phpmysql. Activate field is blank, users aren't still active, right?, (this is my first php book, thanks for your patience...)
  3. Let me know if i understand you ok, <ul class="pagination margin-none pull-right"> <li class="disabled"><a href="#">«</a></li> <li class="active"><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">5</a></li> <li><a href="#">6</a></li> <li><a href="#">7</a></li> <li><a href="#">»</a></li> </ul> CSS .pagination { display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4px; } .pull-right { float: right!important; } .margin-none { margin: 0 !important; }
  4. Hi guys, i want to know how can i accomplish this, 1 - manually add an user to the database and activate it 2 - a script to resend the activation code to a user (user didn't receive the email or lost it) Thanks.
  5. i'm using bootstrap, http://getbootstrap.com/components/#pagination 1 is not linked as an <a>? mmm... how can i solve this? i think is related to the php code, could it be?
  6. Hi everyone, I'm on chapter 10 right now, I want to add some style to the pagination using <ul> and <li>, i'm trying this way... if ($pages > 1) { echo '<ul class="pagination margin-none pull-right"><li>'; $current_page = ($start/$display) + 1; if($current_page != 1){ echo '<a href="view_users.php?s=' . ($start - $display) . '&p=' . $pages . '">Previous</a> '; } for($i = 1; $i <= $pages; $i++){ if($i != $current_page){ echo '<a href="view_users.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '">' . $i . '</a> '; } else { echo $i . ' '; } } if($current_page != $pages){ echo '<a href="view_users.php?s=' . ($start + $display) . '&p=' . $pages . '">Next</a>'; } echo '</li></ul>'; } this is how i see it how can i solve this? thanks!
×
×
  • Create New...