Hi,
Back again I see ;-)
First:
if ( $i=1 )
That should be:
if ( $i == 1 )
(comparison)
You are actually assigning value 1 to $i on every iteration. So,
$i = 1;
[iteration]
$i is assigned 1 by the if statement
$i is incremented by one
[iteration]
$i is assigned 1 by the if statement
$i is incremented by one
[etc]
Get the idea?
Other than that, I see you continuously escape all the quotes (") is this something this forum does, or is it actual code?
$var = ""; // makes $var empty
$var = \"\"; // does ?!?! I dunno..
But I see what you are trying to do, if it's the first iteration, don't use ";" otherwise use it.
You know what I always do? (very quick and dirty I agree)
$var .= $val . ";";
And after the loop do:
$var .= ";";
This creates something like this:
value1;value2;value3;;
Then I do:
$var = ereg_replace(";;", "", $var);
I know it's perhaps not the most perfect way, but creating extra if statements is also not all that perfect.