Reputation: 31
Hi, i'm trying to do a PHP insert using PDO:
$sqlStr = "INSERT INTO agents VALUES (:id,:sport, :firmName, :agentLastName, :agentFirsttName, :address1, :address2, :suite, :city, :stateProv, :zipcode, :country, :phone, :fax, :email, :website, :comment, :lastUpdated)";
I want to bind the MySQL 'Default' keyword to my id because my id is auto incremented. But, 'Default' is already a keyword in PHP.
Is there any way I can accomplish this?
Thanks
Upvotes: 0
Views: 103
Reputation: 927
The quick fix: pass NULL
for the ID.
The good fix: list all fields in the statement that should receive a value and omit the id field. (This way you can also use the auto update capabilities of a TIMESTAMP column)
Upvotes: 1