O que tá pegando While fetch array
Olá pessoal , o que tá pegando com esse código ?
Ele sempre me volta um erro :
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\Program Files (x86)\EasyPHP-5.3.6.0\www\Novo\Conteudo\noticias.php on line 27
Na minha linha 27 é onde fica o while :
essa e minha funçao que eu chamo na minha classe :
function Noticias() {
$this->banco();
$sql = "SELECT * FROM noticias WHERE ver = 'on' ORDER BY id DESC LIMIT 15;'";
$query = mysql_query($sql);
if ($query) {
return $this->resultado2 = $query;
} else {
return false;
}
}
#################################
Esse e onde esta dando o erro
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
include_once '../libActions/Conteudo.php';
$news->Noticias();
$resultado = $news->getResultado2();
while ($linha = mysql_fetch_array($resultado)) { // <------- aqui é onde fica o suposto erro da linha 27
$id = $linha["id"];
$nome = $linha["nome"];
$sobrenome = $linha["sobrenome"];
$cidade = $linha["cidade"];
$estado = $linha["estado"];
$email = $linha["email"];
$data = $linha["data"];
$hora = $linha["hora"];
$titulo = $linha["titulo"];
$subtitulo = $linha["subtitulo"];
$texto = $linha["texto"];
$ver = $linha["ver"];
$novadata = substr($news->getData(),8,2) . "/" .substr($news->getData(),5,2) . "/" . substr($news->getData(),0,4);
$novahora = substr($news->getHora(),0,2) . "h" .substr($news->getHora(),3,2) . "min";
echo "<b>Código da Notícia</b>:" . $news->getId() ;
echo "<br>";
echo "Autor:". $nome . $sobrenome . "E-mail" . $email .getEmail();
echo "<br>";
echo "Cidade:" . $cidade . "Estado : " . $estado;
echo "<br>";
echo "Data:" .$data . - "Horário:" .$hora;
echo "<br>";
echo "Título da Notícia:" .$titulo;
echo "<br>";
echo "Subtítulo da Notícia: <i>" .$subtitulo ."</i>";
echo "<br>";
echo "Notícia: " .$texto;
echo "<br>";
echo "Validado pelo Webmaster: ";
echo "<hr>";
}
?>
######################
Ajude - me por favor pessoal , grato .
Discussão (9)
Carregando comentários...