每次我尝试在我的dastabase中插入一个语句时,我得到一个"不正确的十进制值:'第一行''bounty3'的'NULL'错误.如何将空值插入十进制数据类型?我应该将默认值设为0.00吗?
Incorrect decimal value: '' for column 'bounty3' at row 1 Whole query: INSERT INTO songs (userid, wavURL, mp3URL, genre, songTitle, BPM, insWanted, bounty, insWanted2, bounty2, insWanted3, bounty3, insWanted4, bounty4, insWanted5, bounty5, insWanted6, bounty6, insWanted7, bounty7, insWanted8, bounty8, insWanted9, bounty9, insWanted10, bounty10) VALUES ('12534545', '/audio/wav/jqmrgpfcMichael/135259578210secreason.wav', '/audio/mp3/jqmrgpfcMichael/135259578210secreason.mp3', 'Rock/Funk', 'titlee', '120', 'bass', '20.00', 'guitar', '20.00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
Run Code Online (Sandbox Code Playgroud)
我也用NULL值尝试了这个语句.这是错误:
Incorrect decimal value: 'NULL' for column 'bounty3' at row 1 Whole query: INSERT INTO songs (userid, wavURL, mp3URL, genre, songTitle, BPM, insWanted, bounty, insWanted2, bounty2, insWanted3, bounty3, insWanted4, bounty4, insWanted5, bounty5, insWanted6, bounty6, insWanted7, bounty7, insWanted8, bounty8, insWanted9, bounty9, insWanted10, bounty10) VALUES ('12534545', '/audio/wav/jqmrgpfcMichael/143922765110secreason.wav', '/audio/mp3/jqmrgpfcMichael/143922765110secreason.mp3', 'Rock/Funk', 'title', '110', 'bass', '110.00', 'guitar', '20.00', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL')
Run Code Online (Sandbox Code Playgroud)
小智 13
哦..你试图在bounty3中插入一个空字符串''.将其替换为NULL.我还注意到其他可能的数值的空字符串,例如bonty4.您应该用NULL替换所有空字符串以获取数值.
例如:mysql_query("INSERT INTO empty_number,number VALUES(NULL,1)");
编辑:HEY HEY得到点,你不能将NULL作为'NULL'插入数值,因为这是一个字符串,你应该插入为NULL而不带任何引号
| 归档时间: |
|
| 查看次数: |
19379 次 |
| 最近记录: |