CrustyDOD Posted April 9, 2007 Share Posted April 9, 2007 Hey Don't know maybe i'm just too tired but by running this query for example: SELECT * FROM `table` WHERE id = '1asd' it finds row with ID = 1. What the hell?!? How can it return row if ID = '1' and not '1asd' id int(11) No auto_increment My MySql going crazy or my brains just died? Quote Link to comment https://forums.phpfreaks.com/topic/46294-solved-checking-record-id-weird-result/ Share on other sites More sharing options...
Wildbug Posted April 9, 2007 Share Posted April 9, 2007 Your brains are dead. The column type is INT -- an integer. You're giving it a string in the WHERE clause, so MySQL does its level best to eek an integer out of '1asd.' It comes up with 1. Quote Link to comment https://forums.phpfreaks.com/topic/46294-solved-checking-record-id-weird-result/#findComment-225248 Share on other sites More sharing options...
CrustyDOD Posted April 9, 2007 Author Share Posted April 9, 2007 Ah i see, even this forums have this 'feature', pulling int out of string, if you put some letter behind numbers.... Would be better if it would throw out 0 rows instead of this.. thanks Quote Link to comment https://forums.phpfreaks.com/topic/46294-solved-checking-record-id-weird-result/#findComment-225266 Share on other sites More sharing options...
Wildbug Posted April 9, 2007 Share Posted April 9, 2007 If you don't give it a string... SELECT * FROM `table` WHERE id = 1asd ...you should get an error, which would be zero rows. Quote Link to comment https://forums.phpfreaks.com/topic/46294-solved-checking-record-id-weird-result/#findComment-225269 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.