Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
what would this line of code do? (only small)
Old 09-05-2007, 09:33 PM what would this line of code do? (only small)
Neller's Avatar
Novice Talker

Posts: 13
Name: Alan Neller
Location: England
Trades: 0
Ok having trouble with a downloaded file, it times out (30secs) I went through the code and found this line and when I comment it out the script seems to still work fine and the error goes away I have never really seen code used like this before so was wondering if I was missing anything here is the code...

Code:
  do
{
} while (($_REQUEST['option'] == 'new_item'));
Thats basicly it I have no idea what the use of it is
Neller is offline
Reply With Quote
View Public Profile Visit Neller's homepage!
 
 
Register now for full access!
Old 09-06-2007, 06:15 AM Re: what would this line of code do? (only small)
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Pretty much this code says do nothing while the superglobal 'option' is equal to 'new_item'. It seems like you are timing out because 'option' is always equal to new_item, causing your script to enter an infinite loop. Is there a part of this code missing? There are some cases where an infinite loop can be a good thing but this doesn't seem like one.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 09-06-2007 at 07:54 AM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-06-2007, 07:52 AM Re: what would this line of code do? (only small)
brandrocker's Avatar
Experienced Talker

Posts: 30
Name: CONFIDENTIAL
Location: India
Trades: 0
Quote:
Originally Posted by NullPointer View Post
Pretty much this code says do nothing while the superglobal 'option' is equal to 'new_item'. It seems like you are timing out because new_item is always equal to new_item, causing your script to enter an infinite loop. Is there a part of this code missing? There are some cases where an infinite loop can be a good thing but this doesn't seem like one.
Nice explanation. I suppose this is the cause.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
brandrocker is offline
Reply With Quote
View Public Profile Visit brandrocker's homepage!
 
Old 09-06-2007, 08:39 AM Re: what would this line of code do? (only small)
Neller's Avatar
Novice Talker

Posts: 13
Name: Alan Neller
Location: England
Trades: 0
Thanks for the help,

Nah there is none of the code missing thats all it does, the rest of the script seems to be working totaly fine even tho I removed that loop, I still can't figure out why that would be used there I think there is loads of easier ways to do that.

Thanks again
Neller is offline
Reply With Quote
View Public Profile Visit Neller's homepage!
 
Old 09-06-2007, 10:11 PM Re: what would this line of code do? (only small)
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
That looks like it was written by a lazy coder. Even though superglobal vars can be overwritten and changed, its always better to treat them as static vars. Also the $_REQUEST SG var a mixed array of user input (get, post and cookie) and therfore should never change in theory during the course of execution of the script.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to what would this line of code do? (only small)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29474 seconds with 12 queries