>
na aula 09 do curso de php com mysql , não estou conseguindo listar as news, acho que tem algo a ver com os comandos mysql no netbeans, se alguem puder me ajudar. Vou tentar postar aqui como estão os códigos:
ARQUIVO CONEXAO.PHP
<?php
$server = "localhost";
$user = "root";
$password = "";
$dbName = "sistema";
$conn = @mysqli_connect($server, $user, $password);
$db = @mysqli_select_db($dbName,$conn);
?>
obs: Coloquei o @ na frente do comando, pois sem ele dá erro.
segue o código do listar.php
<?php
include "conexao.php";
?>
<!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>Primeiro Projeto</title>
<style type="text/css">
@import "css/main.css";
</style>
</head>
<body>
<div id="cadastro">
<fieldset>
<legend> Listar News</legend>
<ul>
<?php
$SQL = "SELECT * FROM news";
$query = @mysqli_query($SQL, $conn);
while ($exibir = @mysqli_fetch_array($query)){
?>
<li><?php echo $exibir['data'] ?> - Titulo da News - Por Leonardo - [Veja +]</li>
<?php
}
?>
</ul>
</fieldset>
</div>
</body>
</html>