Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 16th, 2006, 7:07 AM   #1
rockinaway
Newbie
 
Join Date: Feb 2006
Posts: 1
Rep Power: 0 rockinaway is on a distinguished road
Question Basic PHP Help

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?
rockinaway is offline   Reply With Quote
Old Feb 16th, 2006, 7:23 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 16th, 2006, 10:45 AM   #3
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
if you want it infinate, a loop would probably be the best way to go.
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Old Feb 16th, 2006, 10:55 AM   #4
Darkhack
Hobbyist Programmer
 
Darkhack's Avatar
 
Join Date: Dec 2005
Location: Kansas City
Posts: 105
Rep Power: 3 Darkhack is on a distinguished road
Send a message via AIM to Darkhack
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.
Darkhack is offline   Reply With Quote
Old Feb 16th, 2006, 11:38 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
if you want it infinate, a loop would probably be the best way to go.
What in the devil does that mean?
__________________
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
DaWei is offline   Reply With Quote
Old Feb 16th, 2006, 12:07 PM   #6
Darkhack
Hobbyist Programmer
 
Darkhack's Avatar
 
Join Date: Dec 2005
Location: Kansas City
Posts: 105
Rep Power: 3 Darkhack is on a distinguished road
Send a message via AIM to Darkhack
Quote:
Originally Posted by DaWei
What in the devil does that mean?
He was assuming the original poster wanted to perform an action an infinate number of times... (like so)

while(true)
{
	//do stuff
}
Darkhack is offline   Reply With Quote
Old Feb 16th, 2006, 2:18 PM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 18th, 2006, 5:09 PM   #8
MrMan9879
Programmer
 
MrMan9879's Avatar
 
Join Date: Sep 2005
Location: Nanaimo, BC, Canada
Posts: 97
Rep Power: 0 MrMan9879 is an unknown quantity at this point
Send a message via MSN to MrMan9879
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.
MrMan9879 is offline   Reply With Quote
Old Feb 18th, 2006, 5:19 PM   #9
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
Quote:
Originally Posted by MrMan9879
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.
Why the hell would you want to use that .

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.
Polyphemus_ is offline   Reply With Quote
Old Feb 18th, 2006, 5:39 PM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC