Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Bom galera, a pouco eu estava com problemas para colocar link em notícia, o mesmo foi corrigido, só que agora, estou com problemas para mostrar as notícias...
O que está acontecendo, é que está exibindo apenas uma notícia ao invés de 5, o que foi escolhido por mim.
Fiz usando Recordset e Dynamic Table, pelo Dreamweaver CS4...
Vejam o que exibe na página:
/applications/core/interface/imageproxy/imageproxy.php?img=http://img69.imageshack.us/img69/9333/img1fn.png&key=1c85f1ef8c44aa3193b8b80484d228dc7f7a117ac7e06065a6815828ce0f40a3" alt="Imagem Postada" />
E vejam o que exibe no teste do Dynamic Table:
/applications/core/interface/imageproxy/imageproxy.php?img=http://img444.imageshack.us/img444/6306/img2o.png&key=d3fc325f3b682b4809b96bae751ae23ffd0f068dbdb0c7545bbf40e6d4e915d0" alt="Imagem Postada" />
Ou seja, na minha opinião era pra isso funcionar!
Esse foi o código que eu usei:
<?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_noticias = 5;
$pageNum_noticias = 0;
if (isset($_GET['pageNum_noticias'])) {
$pageNum_noticias = $_GET['pageNum_noticias'];
}
$startRow_noticias = $pageNum_noticias * $maxRows_noticias;
mysql_select_db($database_config, $config);
$query_noticias = "SELECT Id, Titulo, `Data` FROM noticias ORDER BY Id DESC";
$query_limit_noticias = sprintf("%s LIMIT %d, %d", $query_noticias, $startRow_noticias, $maxRows_noticias);
$noticias = mysql_query($query_limit_noticias, $config) or die(mysql_error());
$row_noticias = mysql_fetch_assoc($noticias);
if (isset($_GET['totalRows_noticias'])) {
$totalRows_noticias = $_GET['totalRows_noticias'];
} else {
$all_noticias = mysql_query($query_noticias);
$totalRows_noticias = mysql_num_rows($all_noticias);
}
$totalPages_noticias = ceil($totalRows_noticias/$maxRows_noticias)-1;
mysql_free_result($noticias);
?>
<table width="100%" border="0">
<tr>
<td width="7%">#</td>
<td width="69%">Titulo</td>
<td width="24%">Data</td>
</tr>
<tr>
<td><?php echo $row_noticias['Id']; ?></td>
<td><?php echo $row_noticias['Titulo']; ?></td>
<td><?php echo $row_noticias['Data']; ?></td>
</tr>
</table>
Ele exibe apenas um resultado, sendo que no banco de dados tem dois, e é para exibir no máximo 5, como mostra esta linha:
$maxRows_noticias = 5;
O código não pode estar errado, pois foi gerado pelo próprio dreamweaver, mas peço a quem realmente entende do assunto que me ajude com mais este problema... :D
Carregando comentários...