Listing numbers greater than x in a PDO query


1, 4, 12 and 24 numbers available in database
WHERE column_name>=?
When I query with 1 values, it returns 1, 4, 12 and 24
When I query with 2 values, it returns 4 and 14
When I query with 3 values it only gives 4 results

How do I list those greater than or equal to x numbers?

Thank You

It is matching strings not numbers. What is the column_name field format?
If you use ‘2’ or “2” it will consider it a string. If you want to use numbers, remove the quotes.

1 Like

The problem was in the column format
I set the column format to “varchar”
I changed it to “int” format and the problem was fixed.
Thank you so much

Ha! Good!

That is a common problem that new programmers run into. Very common. I try to always use INT for integers, DEC for decimals set to the correct number of decimal places. Like 5.2 so that it is 999.99 or what ever is needed. And, VARCHAR for the rest. But, for some very large text fields, you have to use text.

Each of the different values make compares different depending on the use. Glad you fixed it!

The format of all similar columns is “INT”. However, I don’t understand how it got the format “VARCHAR”. I didn’t think there would be such a mistake.

Thak you

Sponsor our Newsletter | Privacy Policy | Terms of Service