nightkarnation Posted September 15, 2008 Share Posted September 15, 2008 How do i tell this variable (that is coming from Flash): $weeklyRate=$_POST['weeklyRate']; That it is a NUMBER/integer instead of a string... In order for: $result = mysql_query("SELECT neighborhood, capacity, weeklyRate, monthlyRate FROM apt_data where neighborhood = '$neighborhood' AND weeklyRate <= '$weeklyRate'"); To work correctly Appreciate the help! Thanx, Quote Link to comment https://forums.phpfreaks.com/topic/124378-solved-tell-variable-that-it-is-an-integer/ Share on other sites More sharing options...
waynew Posted September 15, 2008 Share Posted September 15, 2008 Try $result = mysql_query("SELECT neighborhood, capacity, weeklyRate, monthlyRate FROM apt_data where neighborhood = '$neighborhood' AND weeklyRate <= $weeklyRate"); I deleted the single quotes on $weeklyRate If that doesn't work,try $weeklyRate=(int)$_POST['weeklyRate']; Quote Link to comment https://forums.phpfreaks.com/topic/124378-solved-tell-variable-that-it-is-an-integer/#findComment-642345 Share on other sites More sharing options...
.josh Posted September 15, 2008 Share Posted September 15, 2008 Force type casting: $weeklyRate = (int) $_POST['weeklyRate']; Although...I'm pretty sure that sql should recognize it as an int as is...not really sure why it wouldn't...did you echo it out first to see that it's got what you're expecting? Maybe it's got a \n or \r or \n\r hiding on there, and you need to trim it instead? Quote Link to comment https://forums.phpfreaks.com/topic/124378-solved-tell-variable-that-it-is-an-integer/#findComment-642347 Share on other sites More sharing options...
nightkarnation Posted September 15, 2008 Author Share Posted September 15, 2008 Thank you very much guys... The first way waynewex posted...works just great The thing was that it was reading it as a number but not correctly since it wasnt giving the real results...and now it works perfect. Quote Link to comment https://forums.phpfreaks.com/topic/124378-solved-tell-variable-that-it-is-an-integer/#findComment-642350 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.