MDanz Posted August 26, 2010 Share Posted August 26, 2010 I have to columns Positive and Negative. i use this as a rating system. e.g. For example if Positive is value 2 and Negative is value 1. Then the total would be 1. i have a variable $order. if i did $order="(Positive-Negative)"; I now that is incorrect. But how do i do that so it order's by the the total of (Positive-Negative) for a row. $construct = "SELECT * FROM Stacks WHERE keywords='$search' AND ({$adult}) ORDER BY `$order` DESC"; Quote Link to comment https://forums.phpfreaks.com/topic/211753-help-with-mysql_query/ Share on other sites More sharing options...
sohaibshaheen Posted August 29, 2010 Share Posted August 29, 2010 I have to columns Positive and Negative. i use this as a rating system. e.g. For example if Positive is value 2 and Negative is value 1. Then the total would be 1. i have a variable $order. if i did $order="(Positive-Negative)"; I now that is incorrect. But how do i do that so it order's by the the total of (Positive-Negative) for a row. $construct = "SELECT * FROM Stacks WHERE keywords='$search' AND ({$adult}) ORDER BY `$order` DESC"; Format simple is: $order=$positive-$negative; but you need to provide more details for in depth help... You didn't mention what you do with negative values? How you store ' $order ' in database, where and in which format? Quote Link to comment https://forums.phpfreaks.com/topic/211753-help-with-mysql_query/#findComment-1104754 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.