Jump to content
Fórum Script Brasil
  • 0

[resolvido]não mostra todos os produtos cadastrados


XIM

Question

Amigos sou eu denovo,tenho este script,tenho o produto cadastrado,me mostra que tem " Registros 1 a 1 de 1", mas não aparece nada só estes dizeres,se puderem me ajudar ficarei muito agradecido,um forte abraço a todos.

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

<?php

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset1 = 13;

$pageNum_Recordset1 = 0;

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

$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];

}

$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

$colname_Recordset1 = "1";

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

$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['cod_cat'] : addslashes($_GET['cod_cat']);

}

mysql_select_db($database_conexao, $conexao);

$query_Recordset1 = sprintf("SELECT * FROM produtos WHERE cod_cat = %s", $colname_Recordset1);

$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

$Recordset1 = mysql_query($query_limit_Recordset1, $conexao) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

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

$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];

} else {

$all_Recordset1 = mysql_query($query_Recordset1);

$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);

}

$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";

if (!empty($_SERVER['QUERY_STRING'])) {

$params = explode("&", $_SERVER['QUERY_STRING']);

$newParams = array();

foreach ($params as $param) {

if (stristr($param, "pageNum_Recordset1") == false &&

stristr($param, "totalRows_Recordset1") == false) {

array_push($newParams, $param);

}

}

if (count($newParams) != 0) {

$queryString_Recordset1 = "&" . implode("&", $newParams);

}

}

$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);

?>

&lt;script language=JavaScript" type="text/JavaScript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>

<div align="center">

<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>

No momento n&atilde;o dispomos de nenhum produto para essa categoria.

<?php } // Show if recordset empty ?>

<br>

<?php do { ?>

<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>

<?php

$cont = "0"; //Define o valor da variável

echo "<table width=\"88%\" height=\"10\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

<tr>"; //Inicia a tabela

while($row_Recordset1 = mysql_fetch_assoc($Recordset1)){ //Loop até encontrar o resultado desejado(talvez não seja isso que está escrito).

if($cont == "4"){ //Se a variável possuir valor 3, fecha a linha atual e inicia outra linha(da tabela) e retorna o valor da variável para zero.

echo "</tr><tr>";

$cont = "0";}

echo "<td align=center ><img src='".$row_Recordset1['fot_peq]."' width='100' height='100' border='0'><br>";

echo $row_Recordset1['nome_prod']."<br>";

echo $row_Recordset1['descricao']."<br>";

echo '<a href=detalhes.php?cod_prod='.$row_Recordset1['cod_prod].'">Ver Detalhes</a>';

echo "</td>";

$cont++;

}

?>

<?php } // Show if recordset not empty ?>

<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

mysql_free_result($Recordset1);

?>

<p>&nbsp; Registros <?php echo ($startRow_Recordset1 + 1) ?> a <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> de <?php echo $totalRows_Recordset1 ?>

<table border="0" width="50%" align="center">

<tr>

<td width="23%" align="center"> <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primeiro</a>

<?php } // Show if not first page ?> </td>

<td width="31%" align="center"> <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Retornar</a>

<?php } // Show if not first page ?> </td>

<td width="23%" align="center"> <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Avan&ccedil;ar</a>

<?php } // Show if not last page ?> </td>

<td width="23%" align="center"> <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">&Uacute;ltimo</a>

<?php } // Show if not last page ?> </td>

</tr>

</table></p>

</div>

Edited by XIM
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Amigos sou eu denovo,tenho este script,tenho o produto cadastrado,me mostra que tem " Registros 1 a 1 de 1", mas não aparece nada só estes dizeres,se puderem me ajudar ficarei muito agradecido,um forte abraço a todos.

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

<?php

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset1 = 13;

$pageNum_Recordset1 = 0;

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

$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];

}

$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

$colname_Recordset1 = "1";

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

$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['cod_cat'] : addslashes($_GET['cod_cat']);

}

mysql_select_db($database_conexao, $conexao);

$query_Recordset1 = sprintf("SELECT * FROM produtos WHERE cod_cat = %s", $colname_Recordset1);

$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

$Recordset1 = mysql_query($query_limit_Recordset1, $conexao) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

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

$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];

} else {

$all_Recordset1 = mysql_query($query_Recordset1);

$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);

}

$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";

if (!empty($_SERVER['QUERY_STRING'])) {

$params = explode("&", $_SERVER['QUERY_STRING']);

$newParams = array();

foreach ($params as $param) {

if (stristr($param, "pageNum_Recordset1") == false &&

stristr($param, "totalRows_Recordset1") == false) {

array_push($newParams, $param);

}

}

if (count($newParams) != 0) {

$queryString_Recordset1 = "&" . implode("&", $newParams);

}

}

$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);

?>

&lt;script language=JavaScript" type="text/JavaScript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>

<div align="center">

<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>

No momento n&atilde;o dispomos de nenhum produto para essa categoria.

<?php } // Show if recordset empty ?>

<br>

<?php do { ?>

<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>

<?php

$cont = "0"; //Define o valor da variável

echo "<table width=\"88%\" height=\"10\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

<tr>"; //Inicia a tabela

while($row_Recordset1 = mysql_fetch_assoc($Recordset1)){ //Loop até encontrar o resultado desejado(talvez não seja isso que está escrito).

if($cont == "4"){ //Se a variável possuir valor 3, fecha a linha atual e inicia outra linha(da tabela) e retorna o valor da variável para zero.

echo "</tr><tr>";

$cont = "0";}

echo "<td align=center ><img src='".$row_Recordset1['fot_peq]."' width='100' height='100' border='0'><br>";

echo $row_Recordset1['nome_prod']."<br>";

echo $row_Recordset1['descricao']."<br>";

echo '<a href=detalhes.php?cod_prod='.$row_Recordset1['cod_prod].'">Ver Detalhes</a>';

echo "</td>";

$cont++;

}

?>

<?php } // Show if recordset not empty ?>

<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

mysql_free_result($Recordset1);

?>

<p>&nbsp; Registros <?php echo ($startRow_Recordset1 + 1) ?> a <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> de <?php echo $totalRows_Recordset1 ?>

<table border="0" width="50%" align="center">

<tr>

<td width="23%" align="center"> <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primeiro</a>

<?php } // Show if not first page ?> </td>

<td width="31%" align="center"> <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Retornar</a>

<?php } // Show if not first page ?> </td>

<td width="23%" align="center"> <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Avan&ccedil;ar</a>

<?php } // Show if not last page ?> </td>

<td width="23%" align="center"> <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">&Uacute;ltimo</a>

<?php } // Show if not last page ?> </td>

</tr>

</table></p>

</div>

resolvido amigos,foi só tirar o

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

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