oracle765 Posted February 9, 2014 Share Posted February 9, 2014 Hi Professionals I have a date calculation to calculate the number of days between two dates which works fine. When I try to put this into MySQL query with the " + $num_of_days + " it does not work any ideas where im going wrong as the query return nothing(code attached) thanks in advance mysql.txt Quote Link to comment https://forums.phpfreaks.com/topic/286054-php-mysql-variable-not-working/ Share on other sites More sharing options...
Barand Posted February 9, 2014 Share Posted February 9, 2014 AND " + $num_of_days + " BETWEEN `DurationDaysMin` AND `DurationDaysMax` You aren't seriously storing the min and max duration columns as varchar and containing the "+" characters and spaces, are you? Quote Link to comment https://forums.phpfreaks.com/topic/286054-php-mysql-variable-not-working/#findComment-1468266 Share on other sites More sharing options...
oracle765 Posted February 9, 2014 Author Share Posted February 9, 2014 hi I am not sure what you mean I did not write the code I am trying to correct it but the dates in the database are stored as varchar yes Quote Link to comment https://forums.phpfreaks.com/topic/286054-php-mysql-variable-not-working/#findComment-1468267 Share on other sites More sharing options...
Barand Posted February 9, 2014 Share Posted February 9, 2014 Bad idea (should be DATE, DATETIME or TIMESTAMP), but I was asking about the `DurationDaysMin` and `DurationDaysMax` fields. Quote Link to comment https://forums.phpfreaks.com/topic/286054-php-mysql-variable-not-working/#findComment-1468268 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.