It says that it has been inserted on database, but Nothing appears there

Asked

Viewed 22 times

0

I save the input information on the "Save" button and then it says that the information has been entered, but when I go to see the database, there’s nothing there, Someone can help me?

<?php 
include "Conexão.php";
if(isset($_POST['Botao']))
{
$PrimeiroNome = $_POST['PrimeiroNome'];
$UltimoNome = $_POST['UltimoNome'];
$Email = $_POST['Email'];
$Telefone = $_POST['Telefone'];
$Endereço = $_POST['Endereço'];
$Aniversario = $_POST['Aniversario'];
$insert = "INSERT INTO 'lista_contactos'('PrimeiroNome', 'UltimoNome', 'Email', 'Telefone', 'Endereço','Aniversario')
VALUES ('$PrimeiroNome','$UltimoNome','$Email','$Telefone','$Endereço','$Aniversario')";
   if(!$insert)
{
echo "Erro a inserir!";
}
else
{
echo "Inserido!";
}
}?>

<form method="POST">
<input type="text" name="PrimeiroNome" placeholder="PrimeiroNome">
<input type="text" name="UltimoNome" placeholder="UltimoNome">
<input type="text" name="Email" placeholder="Email">
<input type="text" name="Telefone" placeholder="Telefone">
<input type="text" name="Endereço" placeholder="Endereço">
<input type="date" name="Aniversario" placeholder="Aniversário">
<input type="submit" name="Botao" placeholder="Guardar">
</form>
  • There are no simple quotes in table and field names. You also need to call/use the database API to send your SQL.

  • You only created the query but did not put it on the connection

  • @rray How do I do this exactly? :\

  • @Marcelorafael How do I do it myself?

  • You have to look for tutorials on the internet to teach you how to do this, I think here would not be very recommended, search youtube for PHP PDO

  • I like this guy: https://www.youtube.com/watch?v=QtCdk459NFg&list=PLfdtiltiRHWHkDwEoZ29Q9FKtWVjA46HC if Voce wrote his question in English should understand

  • @Marcelorafael Thank you very much, I will watch now and try to resolve :D

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.