Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Problemas com páginação de resultados


João Ernani

Question

Ola, estou tentanto fazer uma páginação de resultados. Segue o código usado:

<?php

include("../config/conexao.php");

$per_page = 7;

$sqlc = ("SHOW COLUMNS FROM noticias") or die(mysql_error());

$rsdc = mysql_query($sqlc);

$cols = mysql_num_rows($rsdc);

$page = $_REQUEST['page'];

$start = ($page-1)*7;

$sql = ("SELECT * FROM noticias ORDER BY codigo LIMIT $start,7") or die(mysql_error());

while ($rows = mysql_fetch_assoc($sql)) or die(mysql_error()){?>

<div class=each_rec"><?php echo $rows['titulo];?></div>

<?php }

?>

O erro abresentado é este:

Parse error: syntax error, unexpected T_LOGICAL_OR in D:\wamp\www\websites\website\paginacao\data.php on line 12

No caso o arquivo data seria o código descrito acima.

Agradeço a ajuda de todos, Obrigado!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Continua com o mesmo erro..! Obrigado

Mudei para:

<?php

include("../config/conexao.php");

$per_page = 7;

$sqlc = ("SHOW COLUMNS FROM noticias") or die(mysql_error());

$rsdc = mysql_query($sqlc);

$cols = mysql_num_rows($rsdc);

$page = $_REQUEST['page'];

$start = ($page-1)*7;

$sql = ("SELECT * FROM noticias ORDER BY codigo LIMIT $start,7");

while ($rows = mysql_fetch_assoc($sql)) {?>

<div class=each_rec"><?php echo $rows['titulo];?></div>

<?php }

?>

Mas apresenta o seguinte erro:

Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in D:\wamp\www\websites\website\paginacao\data.php on line 12

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...