Function for exact range |
[eluser]Fantass[/eluser]
Hello, heres the trouble if i want a exact range for example 1-10 do specific function this way Code: <?php But the real trouble is i had to do arround 2 thousand if's by this way, theres another way to do this specifing Example range 20-31 do this.. etc,? Thanks alot.
[eluser]pbflash[/eluser]
Code: if ($input >= 1 && $input <= 10)
[eluser]Fantass[/eluser]
[quote author="CroNiX" date="1330063315"] Code: if ($input >= 20 AND $input <= 31) echo 'OK'; [quote author="pbflash" date="1330063452"] Code: if ($input >= 1 && $input <= 10) Thank yo guys now can yo help me how do this query into MySql? THANKS ALOOOOOOOT
[eluser]PhilTem[/eluser]
How do you want to put it into MySQL? Make the query take care of this check like select only rows if some column's value is within that range? Have a look at http://dev.mysql.com/doc/refman/5.0/en/i...ement.html and http://www.java2s.com/Code/SQL/Flow-Cont...clause.htm for an example. Quick and dirty example: Code: SELECT name AS Name, category AS Category,
[eluser]CroNiX[/eluser]
Selecting Ranges: Code: SELECT fields FROM table WHERE field >= 20 AND field <= 31 Code: SELECT fields FROM table WHERE field BETWEEN 20 AND 31
[eluser]Aken[/eluser]
No offense here, but if you are running loops like THAT, you might want to stay away from CodeIgniter until you get a bit more familiar with PHP. You may be in over your head very quickly.
[eluser]Fantass[/eluser]
[quote author="Aken" date="1330327632"]No offense here, but if you are running loops like THAT, you might want to stay away from CodeIgniter until you get a bit more familiar with PHP. You may be in over your head very quickly.[/quote] Eventually. |
Welcome Guest, Not a member yet? Register Sign In |