![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2006
Posts: 1
Rep Power: 0
![]() |
well i am new to PHP and i know some of the basics.. but i have a line in a file which is..
$sql_limit = ; and my problem is that i want to add something infront of the semi-colon so that the sql limit is infinite.. is this possible if so how? |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Infinity is a concept. If you can't put it on a piece of paper (and I'd like to see you try, other than symbologically), how do you expect a dumb processor to do it? Various types of variables have different maximum and minimum values. Consult your documentation. In PHP, for instance, on certain platforms, anything greater than 1.8e308 is larger than a double; it is, in essence, infinite.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Professional Programmer
|
if you want it infinate, a loop would probably be the best way to go.
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
What are you trying to do? Tell use your overall goal and we can help you with that. A loop would be the best thing to do if you wanted to do something over and over. My guess (from your variable name) you are trying to set the LIMIT on an SQL query. If thats the case, then you can simply leave the LIMIT statement out completely.
|
|
|
|
|
|
#5 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
![]()
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#6 | |
|
Hobbyist Programmer
|
Quote:
while(true)
{
//do stuff
} |
|
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Helluva presumption -- few people do.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 |
|
Programmer
|
Another way to have a loop that goes in forever is something like this:
[PHP] for ($i=0, $i=$i, $i++) { // some code to be executed infinitely }[/PHP] So basically... the code is executed as long as $i is equal to $i, and obviously it's not going to not be equal to itself. |
|
|
|
|
|
#9 | |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
Quote:
.If you want to keep track of how many times you've looped, just increase $i at the end of the block. This looks, IMO, just silly. Last edited by Polyphemus_; Feb 18th, 2006 at 5:38 PM. |
|
|
|
|
|
|
#10 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Ever hear of "for (;;);"? In the absence of optimization it's a more efficient coding of an infinite loop than "while (1);" Why? No expression evaluation.
VC++ assembly code emitted: 0040DD74 jmp main+34h (0040dd74)
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|