I need to check for value range multiple times, this is how i do it till now:
<?php
$preischeck = mysql_query("SELECT preis FROM outfits WHERE aktiv = 'ja' and preis <= 100 $marke $farbe");
if(mysql_num_rows($preischeck) > 0) {
echo "0 - 100 is there";
}
?>
<?php
$preischeck = mysql_query("SELECT preis FROM outfits WHERE aktiv = 'ja' and preis > 100 and preis <= 200 $marke $farbe");
if(mysql_num_rows($preischeck) > 0) {
echo "100 - 200 is there";
}
?>
And so on..
I guess this is too much for the server and there is a better way. Any ideas?
Copyright Notice:Content Author:「Matthias Müller」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/19742534/mysql-query-check-for-value-range-multiple-times