simpli Posted August 19, 2009 Share Posted August 19, 2009 Hi, I have the following sql statement: SELECT `tree`.* FROM `test-company`.`tree` WHERE (node_id = 'dojoUnique5') . There is absolutely no record with node_id = 'dojounique5' in my table yet it returns me the record where node_id = 0. In fact if i replace dojounique5 by z or xxx, it still returns me that record. Anyone can tell me why and whats wrong with my sql? Quote Link to comment https://forums.phpfreaks.com/topic/170923-select-query-returning-weird-resut/ Share on other sites More sharing options...
corbin Posted August 19, 2009 Share Posted August 19, 2009 Is node_id a numeric type field (int, float... so on)? If so, dojoUnique5 is being casted to 0. Quote Link to comment https://forums.phpfreaks.com/topic/170923-select-query-returning-weird-resut/#findComment-901537 Share on other sites More sharing options...
simpli Posted August 19, 2009 Author Share Posted August 19, 2009 Apart from validating the parameter at input time is there anything i can do to prevent the casting? I would like the query to return no data instead of the row with node_id = 0?? Thanks, JR Quote Link to comment https://forums.phpfreaks.com/topic/170923-select-query-returning-weird-resut/#findComment-901703 Share on other sites More sharing options...
fenway Posted August 21, 2009 Share Posted August 21, 2009 "Prevent" makes no sense... it's either an number or a string, not both. Quote Link to comment https://forums.phpfreaks.com/topic/170923-select-query-returning-weird-resut/#findComment-903223 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.