Jiggles
Jiggles

Reputation: 73

SQL INSERT with no errors

I have a problem where I get no errors nothing it all goes though as if nothing was wrong! I had all this working then all of a sudden it just stopped working. All my other SQL stuff works on my script apart from this:

// Submit the form and enter the details into the database
    $result = $dbc->prepare('INSERT INTO users (user_name, pwd, date, user_level) values(?,?,?,?)');
    $result->bind_param('sssi', $username, $hash, $now, $userlevel);
    printf("Errormessage: %s\n", $result->error);
    $result->execute();
    $result->close();

It returns no errors nothing. Its very strange. Nothing is inserted into the DB.

Upvotes: 0

Views: 65

Answers (1)

cypher
cypher

Reputation: 6992

Maybe first execute, then check the error message?

    $result = $dbc->prepare('INSERT INTO users (user_name, pwd, date, user_level) values(?,?,?,?)');
    $result->bind_param('sssi', $username, $hash, $now, $userlevel);
    $result->execute();
    printf("Errormessage: %s\n", $result->error);
    $result->close();

Upvotes: 1

Related Questions