Ciao, ho un tabella così strutturata
codice:
CREATE TABLE `utenti` (
`id` int(20) NOT NULL auto_increment,
`username` text NOT NULL,
`password` text NOT NULL,
`nome` text NOT NULL,
`cognome` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
e, eseguendo questa funzione, non mi fa l'inserimento...
Codice PHP:
function new_user() {
mysql_query("INSERT INTO 'utenti' ( 'id' , 'username' , 'password' , 'nome' , 'cognome' ) VALUES ('', '$_POST[username]', '$_POST[password]', '$_POST[name]', '$_POST[surname]');") or die("Errore durante l'inserimento del nuovo utente");
}
A cosa può essere dovuto l'errore(non ci sono notice o warning, solo il messaggio di errore dato dal die())
PS: Il form è così:
Codice PHP:
<?
if(isset($_POST['name']) && isset($_POST['surname']) && isset($_POST['username']) && isset($_POST['password'])) {
include('functions.php');
connect();
new_user();
}
else
{
print"
<form action='new_user.php' method=post>
<input type=text name='name'>
<input type=text name='surname'>
<input type=text name='username'>
<input type=text name='password'>
<input type=submit>
</form>
";
}
?>
Spero mi possiate aiutare...