Link to home
Start Free TrialLog in
Avatar of Flaviu
Flaviu

asked on

Is this a MySQL bug or a normal behavior?

I am doing the following MySQL query and I get a result that I believe normally it should not occur. I am missing something or is a real MYSQL bug?

SELECT * FROM content WHERE content_id='9G2Mi'

Please see attached image.

The column is Integer - content_id - int(11)
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

if content_id is an integer then you can not search for a string '9G2Mi' you can only search for an integer
Avatar of Olgierd Ungehojer
Olgierd Ungehojer

Integer means full numbers, so your content_id column should have only numbers.
if you wonder why this actually works in some places and not other, you likely are testing without safe mode enabled in which case mysql will silently convert the provided string to an integer ( and most likely return nothing ) but not complain either
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.