denicio
(usa Outra)
Enviado em 02/11/2012 - 11:48h
bom dia!!!,Amigos estou com outro problema aqui,tenho este script,consegui colocar pra ele listar lado a lado,mas gostaria de de coloca-los tipo
lado a lado com 4 produtos e embaixo também,assim sucessivamente até chegar 3 linhas.
ficarei muito agradecido se puderem me ajudar,tentei montar a tabela,mas continua lado a lado e listando os 6 produtos.
<?php require_once('Connections/conexao.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 3;
$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);
?>
<table cellspacing=0 cellpadding=0 width="88%"align="center" border=0 >
<tr>
<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
No momento não dispomos de nenhum produto para essa categoria.
<?php } // Show if recordset empty ?>
<?php $i = 0; do { ?>
<?php if ($i == 5)
{
echo "</tr>";
} ?>
<td><div align="center"><img src="<?php echo $row_Recordset1['fot_peq'];?>" width='120' height='120' alt="" onMouseOver="aumenta(this)" onMouseOut="diminui(this)"></div>
<FONT FACE="ARIAL" COLOR="BLUE"><font size="2">
<div align="center"><strong><?php echo $row_Recordset1['nome_prod']; ?></strong></div>
<div align="center"><FONT COLOR="#F8F8FF"><?php echo $row_Recordset1['descricao']; ?></div>
</FONT FACE="script mt bold" COLOR="BLUE"></font size="2"></FONT COLOR="#F8F8FF">
<div align="center"><FONT FACE="ARIAL" COLOR="BLUE"><font size="2">Por : R$ <?php echo $row_Recordset1['valor']; ?></div>
<center><img src="comprar.JPG" alt="" title="" /></center></FONT FACE="ARIAL" COLOR="BLUE"><font size="2">
<p> Registros <?php echo ($startRow_Recordset1 + 1) ?> a <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> de <?php echo $totalRows_Recordset1 ?>
<td>
<br>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
mysql_free_result($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); ?>"><FONT FACE="script mt bold" COLOR="BLUE"><font size="3">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); ?>"><FONT FACE="script mt bold" COLOR="BLUE"><font size="3">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); ?>"><FONT FACE="script mt bold" COLOR="BLUE"><font size="3">Avanç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); ?>"><FONT FACE="script mt bold" COLOR="BLUE"><font size="3">Último</a>
<?php } // Show if not last page ?> </td>
</tr>
</table></p>
</div>