php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46591 replace into syntax cannot null for PK in mysql
Submitted: 2008-11-17 06:24 UTC Modified: 2008-11-17 15:57 UTC
From: akbar6393222 at yahoo dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.6 OS: *
Private report: No CVE-ID: None
 [2008-11-17 06:24 UTC] akbar6393222 at yahoo dot com
Description:
------------
I execute this directly on mysql 5.1.25-rc-community on command line, it's work

REPLACE INTO qna_content (id,service_id,qna_id,service,sub_service,content,sub_content,publish_date,status,ctn_seq,first_ctn,last_update,update_by) VALUES ( '','1','1','alam', '','tes','','0000-00-00','1', '1', '0', NOW(), 'akbar' )


But in php 5.2.6, trigger error :
Incorrect integer value: ' ' for column 'id' at row 1
error number 1366

Reproduce code:
---------------
REPLACE INTO qna_content (id,service_id,qna_id,service,sub_service,content,sub_content,publish_date,status,ctn_seq,first_ctn,last_update,update_by) VALUES ( '','1','1','alam', '','tes','','0000-00-00','1', '1', '0', NOW(), 'akbar' )


Expected result:
----------------
I need to be work for that code so I don't need to check another filter validation

Actual result:
--------------
Incorrect integer value: ' ' for column 'id' at row 1
error number 1366

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-17 10:58 UTC] lbarnaud@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This error message from MySQL is displayed when you are using some non-default sql_modes. See http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
Your PHP script probably sets a mode that triggers this error.
 [2008-11-17 15:56 UTC] akbar6393222 at yahoo dot com
I have found the problem, that sql_mode is STRICT_TRANS_TABLES.
Thanx u so much
 [2008-11-17 15:57 UTC] akbar6393222 at yahoo dot com
I have found the problem, that sql_mode is STRICT_TRANS_TABLES.
Thanx u so much
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 22:01:27 2024 UTC