View Single Post
Old 03-27-2008, 08:18 PM   #1 (permalink)
djscour
The Visitor
 
Join Date: Mar 2008
Posts: 2
Thanks: 1
djscour is on a distinguished road
Confused newbie - what does this code mean?

Hi,

Warning I'm a total newbie at both php and any type of coding at all. I was hoping someone could explain a line of code in a for loop for a php/mysql tutorial that I I've been trying to do. The following is the loop:

for ($i=0; $i< $nRows; $i++){


$row = mysql_fetch_array($qResult);


$rString .="&ID".$i."=".$row['ID']."&visitor".$i."=".$row['visitor']."&time".$i."=".$row['time']."&comment".$i."=".$row['comment'];
}


echo $rString."&";

The part I don't fully grasp is:

$rString .="&ID".$i."=".$row['ID']."&visitor".$i."=".$row['visitor']."&time".$i."=".$row['time']."&comment".$i."=".$row['comment'];
}


My guess is this formats the output and calls the variables that will display in the echo $rString."&"; I guess what I don't understand is partially syntax related. I understand that the stuff with $ in it are variables and the stuff in the [ ] refers to items in the array but I don't understand what the stuff with the ampersand is doing. Also why does the = sign have to be in quotes? Thanks.

djscour
djscour is offline  
Reply With Quote