-4
When sending the form to register the email entered in the field it should simply register in the database, but it does not register, how can I solve?
<?php
$conect = mysqli_connect('127.0.0.1','root@localhost','') or die ("erro de conecção");
$banco = mysqli_select_db($conect,'oserpoeta');
var_dump($banco)
?>
Page picks data
<?php
include = 'cad_&else.php';
//Cadastra os dados
$email = $_POST ["email"];
$link = "INSERT INTO 'newllester' ('email') VALUES ('$email')";
$qur = mysqli_query($link,'$sql')or die('erro:'.mysqli_error ());
header("location: http://serpoeta.localhost/serpoeta/")
?>
mysqli_connect
; 2. What is the return ofvar_dump($banco)
? 3. Do not place single quotes in table name or column name - if you want to avoid conflict, use crases; 4. Read function documentationmysqli_query
and review the order of the parameters; 5. What should be the variable$sql
which it used inmysqli_query
?– Woss
There will be no single quotes in the table name. Do not place single quotes in variables like =>
'$sql')or die(...);
– rray
Improving a line:
$conect = mysqli_connect('127.0.0.1','root@localhost','','oserpoeta') or die ("erro de conecção");
You can already set the bank together.– rbz