0
I’m 16 hours away trying to make a database connection work and I’m not getting it, I don’t know what I’m doing wrong, I’m currently using shaman, and I’m working for a client who needs to access the database in a relatively simple way, and that connection doesn’t unravel.
$_POST['botao'];
$nivel = $_POST['depressao'];
$servername = "localhost";
echo $servername;
$database = "test";
echo $database;
$username = "root";
echo $username;
$password = "";
echo $password;
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
$query = "insert into triste (depressao) values ({$nivel})";
mysqli_query($conn, $query);
mysqli_close();
?>
<form action="conexao.php">
<input name="depressao" />
<button type="submit" name="botao"></button>
</form
>
Yes I changed the database to a table and a test db, to force some errors out of production, and the database just doesn’t connect, I’ve tried to make this connection in several ways, I don’t know what to do, I’m almost changing to Node.js. that although I do not know much, at least I know in Js, I know la to really lost. who can give me a light I am grateful!
if (!$conn) {
 printf("Connect failed: %s\n", mysqli_connect_error());
 exit(); }
.. View documentation– NoobSaibot
If you try to connect with these command line parameters what happens?
– Augusto Vasques
Nothing happens, he simply ignores all the php code that is written. and doing some testing today, I discovered that this code is being commented on the console. The code is being commented whole with comment in the generated html page <!---->
– Thiago Guimarães