Jump to content
Fórum Script Brasil
  • 0

Problemas com a lista depois de gerar o recordset


Wellingtons.com.br

Question

Amigos,

Estou fazendo um site de notícias. Assim, criei bancos do mysql e fiz os gerenciadores e formulário de consulta no DW. Deu super certo.

No entanto quando fui criar página com a lista de notícias com parametros. Ela não aparece, mesmo que no teste mostre os registros solicitados. Quando retiro os parametros a página lista os registros vai o código.

Este é o código com o parametro

$maxRows_rsNot_index = 5;

$pageNum_rsNot_index = 0;

if (isset($_GET['pageNum_rsNot_index'])) {

$pageNum_rsNot_index = $_GET['pageNum_rsNot_index'];

}

$startRow_rsNot_index = $pageNum_rsNot_index * $maxRows_rsNot_index;

$colname_rsNot_index = "-1";

if (isset($_GET['noticia'])) {

$colname_rsNot_index = $_GET['noticia'];

}

mysql_select_db($database_conEai, $conEai);

$query_rsNot_index = sprintf("SELECT * FROM noticias WHERE not_secao LIKE %s ORDER BY not_id DESC", GetSQLValueString("%" . $colname_rsNot_index . "%", "text"));

$query_limit_rsNot_index = sprintf("%s LIMIT %d, %d", $query_rsNot_index, $startRow_rsNot_index, $maxRows_rsNot_index);

$rsNot_index = mysql_query($query_limit_rsNot_index, $conEai) or die(mysql_error());

$row_rsNot_index = mysql_fetch_assoc($rsNot_index);

if (isset($_GET['totalRows_rsNot_index'])) {

$totalRows_rsNot_index = $_GET['totalRows_rsNot_index'];

} else {

$all_rsNot_index = mysql_query($query_rsNot_index);

$totalRows_rsNot_index = mysql_num_rows($all_rsNot_index);

}

$totalPages_rsNot_index = ceil($totalRows_rsNot_index/$maxRows_rsNot_index)-1;

?>

Esse caso aceita o teste, mas não lista

nesse código, sem parametro - a página lista normalmente

<?php require_once('../Connections/conEai.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

$maxRows_rsNot_index = 5;

$pageNum_rsNot_index = 0;

if (isset($_GET['pageNum_rsNot_index'])) {

$pageNum_rsNot_index = $_GET['pageNum_rsNot_index'];

}

$startRow_rsNot_index = $pageNum_rsNot_index * $maxRows_rsNot_index;

mysql_select_db($database_conEai, $conEai);

$query_rsNot_index = "SELECT * FROM noticias ORDER BY not_id DESC";

$query_limit_rsNot_index = sprintf("%s LIMIT %d, %d", $query_rsNot_index, $startRow_rsNot_index, $maxRows_rsNot_index);

$rsNot_index = mysql_query($query_limit_rsNot_index, $conEai) or die(mysql_error());

$row_rsNot_index = mysql_fetch_assoc($rsNot_index);

if (isset($_GET['totalRows_rsNot_index'])) {

$totalRows_rsNot_index = $_GET['totalRows_rsNot_index'];

} else {

$all_rsNot_index = mysql_query($query_rsNot_index);

$totalRows_rsNot_index = mysql_num_rows($all_rsNot_index);

}

$totalPages_rsNot_index = ceil($totalRows_rsNot_index/$maxRows_rsNot_index)-1;

?>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...