Bluehost.com Web Hosting $6.95

Re: [PHP] Re: How to do this? 6 lines of code...Parse error

This is a discussion on Re: [PHP] Re: How to do this? 6 lines of code...Parse error within the PHP General forums, part of the PHP Programming Forums category; Hey, OK, got it, thanks! -Ryan On 1/4/2004 1:00:04 AM, Aidan Lister (aidan@virtualexplorer.com.au) ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-04-2004
Ryan A
 
Posts: n/a
Default Re: [PHP] Re: How to do this? 6 lines of code...Parse error

Hey,
OK, got it, thanks!
-Ryan


On 1/4/2004 1:00:04 AM, Aidan Lister (aidan@virtualexplorer.com.au) wrote:
> Firstly
> I'd rewrite your other script to store the data in an array.
>
> The benefits of doing so are simply demonstrated:
>
> <?php
> foreach ($products as $product)
> dosomethingto($product);
> ?>
>
> However, if you are unable to rewrite your script:
>
> The correct syntax is:
> <?php
> ${'product' . $i}
> ?>
>
> "Ryan A" <ryan@coinpass.com> wrote in message
> news:004001c3d242$2ff18de0$0000fea9@l2zcaxu7emppqh ...
> > Hi,
> > am a bit confused as to how you do this...first let me explain the flow

of
> > input:
> > I will be getting $product1,$product2,$product3 etc from another

> script...I
> > dont know till what number....right now I am trying to catch the values

> till
> > 20 with a "for" loop.
> >
> > My problem is how do I attach the $i that I am using to the $product to
> > check if its set? Heres my code and below that you will see some of the
> > stuff I have tried:
> >
> >
> > for($i=1; $i<21; $i++)
> > { if(isset($product$i))
> > {echo "Product".$i." is set!<br>";}
> > else(!isset($product$i))
> > {echo "Product".$i." is NOT set!<br>";}}
> > exit;

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:56 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0