
11/10/2013, 22:15
|
 | | | Fecha de Ingreso: junio-2012
Mensajes: 84
Antigüedad: 12 años, 8 meses Puntos: 2 | |
Respuesta: mysqli dentro de una funcion esta funcion me permite realizar paginacion usando la extensión mysqli
require_once 'config.php';
function getCountries($num, $total){
$conexion = mysqli_connect(HOST,USER,PASS,BD);
$consulta = "SELECT name FROM countries LIMIT $num,$total";
$result = $conexion->query($consulta);
$arr = array();
while($row = mysqli_fetch_array($result)){
$arr[] = $row;
}
return $arr;
if(!$conexion){
echo mysqli_error();
}
}
config.php
<?php
define('HOST','localhost');
define('USER','root');
define('PASS','trtr01');
define('BD','mundo');
?>
le mando datos con ajax a $total |