PHP mysqli Insert not working, but not giving any errors.
Posted
by asdasdas
on Stack Overflow
See other posts from Stack Overflow
or by asdasdas
Published on 2010-04-20T18:17:11Z
Indexed on
2010/04/20
18:43 UTC
Read the original article
Hit count: 431
As the title says Im trying to do a simple insert, but nothing actually is inserted into the table. I try to print out errors, but nothing is reported.
My users table has many more fields than these 4, but they should all default.
$query = 'INSERT INTO users (username, password, level, name) VALUES (?, ?, ?, ?)';
if($stmt = $db -> prepare($query))
{
$stmt -> bind_param('ssis', $username, $password, $newlevel, $realname);
$stmt -> execute();
$stmt -> close();
echo 'Any Errors: '.$db->error.PHP_EOL;
}
There are no errors given, but when I go to look at the table in phpmyadmin there is not a new row added. I know for sure that the types are correct (strings and integers). Is there something really wrong here or does it have something to do with the fact that I'm ignoring other columns. I have about 8 columns in the user table.
© Stack Overflow or respective owner