stevebluck Posted October 7, 2009 Share Posted October 7, 2009 Hello, one of my mysql fields is called "meta_value" and has a type of "longtext". Sometimes I need to use a query to see if an integer is equal to or greater than another integer within this field like so: $price = "p3.meta_key='price_value' AND p3.meta_value >= '150000"; This obviously does not work because its simply matching the text rather then the value of the integer. So this query would return values such as: 150000 400 400000 Which is not what I want. I want to keep the field as "longtext" but somehow treat the value as an integer type when I need to. The value will always be an integer in the price_value meta_key. I'm sure it's an easy fix! Thanks Link to comment https://forums.phpfreaks.com/topic/176813-solved-longtext-trouble/ Share on other sites More sharing options...
stevebluck Posted October 7, 2009 Author Share Posted October 7, 2009 You can view the query in action here, select a price on the left and click search http://www.stevebluck.co.uk/turs/wp/?page_id=27 Link to comment https://forums.phpfreaks.com/topic/176813-solved-longtext-trouble/#findComment-932243 Share on other sites More sharing options...
stevebluck Posted October 7, 2009 Author Share Posted October 7, 2009 Solved! [pre] convert(p3.meta_value, signed) [/pre] This converts a string to an integer! Link to comment https://forums.phpfreaks.com/topic/176813-solved-longtext-trouble/#findComment-932246 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.