1
I have the following code:
<?php
//iniciando a conexão com o banco de dados
include_once("conectar.php");
if (!$strcon) {
die('Não foi possível conectar ao Banco de Dados');
}
$sql = mysqli_query("SELECT * FROM cadastro");
$exibe = mysqli_fetch_assoc($sql);
echo "<table>";
echo "<tr><td>Nome:</td>";
echo "<td>".$exibe["Nome"]."</td></tr>";
?>
I have tried to create the structure in various ways. The results displayed in HTML for me are:
Warning: mysqli_query() expects at least 2 Parameters, 1 Given in C: Program Files Easyphp-Devserver-17 eds-www Sites Projects Calendar query.php on line 18
Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, null Given in C: Program Files Easyphp-Devserver-17 eds-www Sites Projects Calendar query.php on line 19 Name:
My line 18:
$sql = mysqli_query("SELECT * FROM cadastro");
My Line 19:
$exibe = mysqli_fetch_assoc($sql);
I’ve modified the parameters in several ways, but I can’t find the exact problem.
Probably, it should only take this variable that is being built in this "connect.php" and pass as the first parameter.
– adrianosmateus
I added your comment to the reply @Leocaracciolo.
– adrianosmateus
Now it’s gone off!
– user60252
the connection variable is
$strcon
– user60252