Dove il seguente esercizio è sbagliato?
PHP:
<?php
try{
$dbh= new PDO("mysql:host=localhost; dbname=prova","bismark","bismark");
//Prepariamo la query con il metodo prepare()
$st=$dbh->prepare("INSERT INTO anagrafica(id,nome,cognome,nascita)VALUES(:id,:nome,:cognome,:nascita)");
$st->bindParam(':id', $id);
$st->bindParam(':nome',$nome);
$st->bindParam(':cognome',$cognome);
$st->bindParam(':nascita',$nascita);
//Inserisco la prima riga
$id=1;
$nome='Nome1';
$cognome='Cognome1';
$nascita=1980;
}catch(PDOException $e)
{
echo 'Errore: ' . $e->getMessage();
}
?>
Ultima modifica di un moderatore: