1
Good evening, I’m having second thoughts about a certain code. It should search all users in the database and list... however of the error...
Follow the excerpt of the code where I make the instructions to retrieve the data:
<?php
session_start();
include "seguranca.php";
include "conexao.php";
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Painel Administrativo">
<meta name="author" content="Prisma Design">
<link rel="icon" href="imagens/favicon.ico">
<title>Painel Administrativo</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<link href="css/dashboard.css" rel="stylesheet">
<script src="js/ie-emulation-modes-warning.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="administrativo.php">Painel Administrativo 0.1 BETA</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Painel</a></li>
<li><a href="#">Configurações</a></li>
<li><a href="#">Perfil</a></li>
<li><a href="#">Ajuda</a></li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Procurar...">
</form>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="administrativo.php">Vista geral</a></li>
<li><a href="#">Suporte</a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="adiciona_user.php">Adicionar usuário</a></li>
<li class="active"><a href="lista_user.php">Listar usuários <span class="sr-only">(current)</span></a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h3 class="page-header"><?php echo "Bem vindo: ".$_SESSION['usuarioNome']; ?></h3>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<table class="table table-hover">
<tr>
<th>Nome</th>
<th>E-mail</th>
<th>Usuário</th>
<th>Nível</th>
</tr>
<?
$lista = mysqli_connect($conectar, "SELECT * FROM `usuario`");
while($escrever=mysql_fetch_array($lista)){
echo “<tr><td>” . $escrever[’nome’] . “</td><td>” . $escrever[’email’] . “</td><td>” . $escrever[’usuario’] . “</td><td>” . $escrever[’nivel_acesso_id’] . “</td></tr>”;
}
echo “</table>”;
</table>
mysql_close(conexao);
?>
<tr>
</table>
</div>
</div>
</div>
</body>
</html>
EDIT!
I did what you told me, now you’re making this mistake here:
the error is being in php, line 80 as print shows, an unexpected character '<' check this line or post full php
– Rovann Linhalis
the line 80: echo "<tr><td>" . $write['name'] . "</td><td>" . $write['email'] . "</td><td>" . $write['user'] . "</td><td>" . $write['nivel_acesso_id'] . "</td><tr>";
– Pedro Ribeiro
the last tag, you are not closing the
<tr>
, has to stay</tr>
although this seems to be an html error, not php error. You can edit the question to put the full code.– Rovann Linhalis
I edited with the full code, I closed the tag, however it is not the error
– Pedro Ribeiro
Peter you are using mysqli and not mysql Connection. The code I demonstrated it’s not by mysqli.
– mistake S
@mistakes But when using mysql , gives Warning warning that is no longer used
– Pedro Ribeiro