Hello,
I am trying to filter an array that I am pulling from a mySQL database using PHP.
My question is if there is a way to LIMIT the number of rows that are pulled from the database with a mathematical operation in the SQL statement. I think it would something like:
My objective is to be able to filter the array after a user selects a value from a dropdown option list. The value in the drop down would be stored in the URL and $selected_value would be determined by this value in the URL by the _GET method.
Any help on this would be appreciated!
Thanks!
I am trying to filter an array that I am pulling from a mySQL database using PHP.
My question is if there is a way to LIMIT the number of rows that are pulled from the database with a mathematical operation in the SQL statement. I think it would something like:
Code:
$sql = sprintf(SELECT * FROM data WHERE day = CURdate()-INTERVAL 1 day AND statistic_id = %d ORDER BY value DESC LIMIT value > %d, $statistic_id, $selected_value);
Any help on this would be appreciated!
Thanks!
Comment