Skip to content
This repository was archived by the owner on Oct 11, 2019. It is now read-only.
This repository was archived by the owner on Oct 11, 2019. It is now read-only.

Fatal error on insert data.. not solved but skipped.. #1

@ghost

Description

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined'

There is something interesting about this error.. i'm try to insert name, url, and some text..

There is two ways on skipping the error..

Skipping error with '@'

@$query->execute($params, FALSE);

put '@' sign at first query object and send the params as array array(':name','steevenz'); and place second parameter at the execute function.. doing this way is causing error that PDO execute function is only accept 1 parameter but two given.. but because we put '@' sign.. to skipping the error.. so.. seems to be fine.. and the data still insert into the table.

Using try and catch error..

try { $query->bindValue($param->name, utf8_encode($param->value), \PDO::PARAM_STR); }
catch(\PDOException $e) {}

the error doesn't appear and the data still insert into the table..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions