Al parecer ya hay demasiados temas sobre esto, y como dicen las reglas del foro antes de hacer un tema, primero busqué si algunos otros podían ayudarme pero no encuentro una solución a esto:
Código PHP:
<?php
$tbl_name="items"; //your table name
// How many adjacent pages should be shown on each side?
$adjacents = 3;
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
$q=$_GET['q'];
/*$query = "SELECT COUNT(*) as num FROM $tbl_name";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];*/
//ALTERNATIVO
$query = mysql_query("Select * from $tbl_name WHERE item_nombre like '%$q%'");
$total_pages = mysql_num_rows($query);
if ($total_pages > '0'){
/* Setup vars for query. */
$targetpage = "search.php"; //your file name (the name of this file)
$limit = 6; //how many items to show per page
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
$sql = "SELECT * FROM $tbl_name WHERE item_nombre LIKE '%$q%' ORDER BY `peliculas`.`id_item` DESC LIMIT $start, $limit";
//$sql = "SELECT * FROM $tbl_name WHERE item_nombre LIKE '%$q%' ORDER BY `peliculas`.`id_item` DESC LIMIT $total_pages";
$result = mysql_query($sql);
Aquí les dejo el código original: http://phpeasystep.com/phptu/29.html
Supongo que la clave está en el comentario:
Cita:
pero no logro comprenderlo, espero que me puedan ayudar./*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
De Antemano, Gracias