Re: while() looping over query results twice?
| From: | Jim Lucas | Date: | Thu, 25 Oct 2001 20:22:55 +0000 |
| Subject: | Re: while() looping over query results twice? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72344@lists.php.net to get a copy of this message | ||
what I guessed was that you were using the variables somewhere else in the
script above this code. then you were adding on to them again. without
resetting them to blank. Are you using these vars somewhere else (above
this) in your code?
jim
----- Original Message -----
From: "Kurt Lieber" <kurt@lieber.org>
To: "Jim Lucas" <or001@bend.com>; <php-general@lists.php.net>
Sent: Thursday, October 25, 2001 1:17 PM
Subject: Re: [PHP] while() looping over query results twice?
> OK, so I defined the variables before using them and that solved the
problem.
> (Thanks!)
>
> I'm still curious as to why not defining them ahead of time would cause
the
> data within each string to get duplicated. In other words, if the query
> results are "a,b,c,d", then by not defining the variable ahead of time
> produces "a,b,c,d,a,b,c,d" which is weird.
>
> At this point, my problem is solved, so this is more of an academic
question
> than anything.
>
> Thanks for the help.
>
> --kurt
>
> On Thursday 25 October 2001 13:03, Jim Lucas wrote:
> > I notice that you are concatinating then each time. try setting them to
> > ="" before using them
> >
> > $companyID_string = "";
> > $companyName_string = "";
> > then:
> > while()
> > {
> > $companyID_string .= "," . $query_data[0];
> > $companyName_string .= "," . $query_data[1];
> > }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>