1) { for ($i = 0; $i < $c; $i++) { $search = $explodeit[$i] . "+"; } } else { $search = $s_string; } } echo "Número de resultados por página: 5"; echo " 10
"; // Figure out the limit for the query based // on the current page number. $from = (($page * $max_results) - $max_results); // Perform MySQL query on only the current page number's results if (!isset($_GET['search'])) { $set_lim = "SELECT * FROM $table_name ORDER BY username LIMIT $from, $max_results"; } else { $search = $_GET['search']; $set_lim = "SELECT * FROM $table_name WHERE username LIKE '%$search%' || firstname LIKE '%$search%' || lastname LIKE '%$search%' || group1 LIKE '%$search%' || group2 LIKE '%$search%' || group3 LIKE '%$search%' || email LIKE '%$search%' ORDER BY username LIMIT $from, $max_results"; } $set_res = @mysql_query($set_lim, $connection) or die(mysql_error()); while ($set_lim = mysql_fetch_object($set_res)) { $fname = $set_lim->firstname; $lname = $set_lim->lastname; $uname = $set_lim->username; $p_change = $set_lim->pchange; $verif_d = $set_lim->verified; $last = $set_lim->last_login; $re_direct = $set_lim->redirect; $groupA = $set_lim->group1; $groupB = $set_lim->group2; $groupC = $set_lim->group3; $e_mail = $set_lim->email; if ($p_change == 1) { $p_change = "Yes"; } else { $p_change = "No"; } if ($verif_d == "0") { $verif_d = "No"; } else { $verif_d = "Yes"; } echo "
| $uname | "; echo "E-Mail: | "; echo "$e_mail | "; echo "
| "; echo "Modificar"; echo " "; if ($uname != $_SESSION[user_name]) { echo "Eliminar"; /*echo "Eliminar";*/ } echo " | "; echo "Nombre: | "; echo "$fname $lname | "; echo "
| "; echo " | Último acceso: | "; echo "$last | "; echo "
"; } // Figure out the total number of results in DB: if (!isset($_GET['search'])) { $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM authorize") , 0); } else { $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM authorize WHERE username LIKE '%$search%' || firstname LIKE '%$search%' || lastname LIKE '%$search%' || group1 LIKE '%$search%' || group2 LIKE '%$search%' || group3 LIKE '%$search%' || email LIKE '%$search%'"),0); } // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); if ($total_pages > 1) { // Build Page Number Hyperlinks echo "
"; // Build Previous Link if($page > 1) { $prev = ($page - 1); echo "<< "; } for($i = 1; $i <= $total_pages; $i++) { if(($page) == $i) { echo "$i "; } else { echo "$i "; } } // Build Next Link if($page < $total_pages) { $next = ($page + 1); echo " >>"; } echo "
"; } ?>