Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Estou com esse erro a 2 semanas, e ate agora nao consegui resolver NADA! :/
Olhem: http://www.uorning.net/woax/
Olhem na parte de noticias recentes, la em cima no canto superior direito ...
Ele da esse erro:
Warning: mysql_fetch_assoc(): 4 is not a valid MySQL result resource in /home/uorningn/public_html/woax/anuncios.php on line 59Fala que o erro é na linha 59... mas:
57 | <?php do { ?>
58 | <?php echo $row_anuncios['texto']; ?>
59 | <?php } while ($row_anuncios = mysql_fetch_assoc($anuncios)); ?>
Mas se preferir, olhe o codigo inteiro:
<?php require_once('Connections/connDB.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_anuncios = 7;
$pageNum_anuncios = 0;
if (isset($_GET['pageNum_anuncios'])) {
$pageNum_anuncios = $_GET['pageNum_anuncios'];
}
$startRow_anuncios = $pageNum_anuncios * $maxRows_anuncios;
mysql_select_db($database_connDB, $connDB);
$query_anuncios = "SELECT texto FROM anuncios ORDER BY id DESC";
$query_limit_anuncios = sprintf("%s LIMIT %d, %d", $query_anuncios, $startRow_anuncios, $maxRows_anuncios);
$anuncios = mysql_query($query_limit_anuncios, $connDB) or die(mysql_error());
$row_anuncios = mysql_fetch_assoc($anuncios);
if (isset($_GET['totalRows_anuncios'])) {
$totalRows_anuncios = $_GET['totalRows_anuncios'];
} else {
$all_anuncios = mysql_query($query_anuncios);
$totalRows_anuncios = mysql_num_rows($all_anuncios);
}
$totalPages_anuncios = ceil($totalRows_anuncios/$maxRows_anuncios)-1;
?>
<?php
mysql_free_result($anuncios);
?>
<p>
<?php do { ?>
<?php echo $row_anuncios['texto']; ?>
<?php } while ($row_anuncios = mysql_fetch_assoc($anuncios)); ?>
</p>
connDB.php
<?php
$connDB = mysql_pconnect($hostname_connDB, $username_connDB, $password_connDB) or trigger_error(mysql_error(),E_USER_ERROR);
?>---- by dreamweaver ;D
obrigado desde ja!
Carregando comentários...