João Ernani Posted November 25, 2011 Report Share Posted November 25, 2011 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 12No caso o arquivo data seria o código descrito acima.Agradeço a ajuda de todos, Obrigado! Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted November 25, 2011 Report Share Posted November 25, 2011 while ($rows = mysql_fetch_assoc($sql)) {?> Quote Link to comment Share on other sites More sharing options...
0 João Ernani Posted November 25, 2011 Author Report Share Posted November 25, 2011 Continua com o mesmo erro..! ObrigadoMudei 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 Quote Link to comment Share on other sites More sharing options...
0 João Ernani Posted November 25, 2011 Author Report Share Posted November 25, 2011 (edited) Ola pessoal, agradeço..já resolviObrigado :) Edited November 25, 2011 by João Ernani Quote Link to comment Share on other sites More sharing options...
Question
João Ernani
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.