Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Paginação

$
0
0

Boa tarde pessoal estou tentando fazer uma paginação, esta tudo igual ao video que vi, mas não esta a funcionar, da o seguinte erro.

 

  • Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /htdocs/public/www/adotados.php on line 133

 

este é o código:

<?php
// Criando conexão
$link = mysql_connect('hostingmysql243.amen.pt', 'BD', '123456');
if (!$link) {
die('Não foi possível conectar: ' . mysql_error());
}
//echo 'Conexão bem sucedida';
$db_selected = mysql_select_db('rebornimaginacoesdebebes_com_pt_bdreborn', $link);
$limite = 8;
$SQL_COUNT = mysql_query("SELECT COUNT('Registo') from bebes");
$SQL_RESUL = ceil(mysql_result($SQL_COUNT, 0) / $limite);

$PG = (ISSET($_GET["pg"])) ? (int)$_GET["pg"] : 1;

$inicio = ($pg - 1) * $limite;

$sql=mysql_query("SELECT * FROM bebes LIMIT $inicio, $limite ORDER BY Registo asc");
while ($linha = mysql_fetch_array($sql)){
$nome = $linha['Nome'];
$foto = $linha['Foto'];
 
echo "<li>
<a href='$nome.html' title='$nome'><img src='imagens/miniatura/$foto' width='100' height='80' alt='$nome'></a>
</li>";}
?>

Viewing all articles
Browse latest Browse all 14190

Trending Articles