Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting together string

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I was wondering if anybody could help me out. I am putting together a string which will be emailed. The problem I am having is putting a for loop in there while following php rules on concatination for the string. I am not exactly sure how to do this and if anybody could help me out it would be very much appreciated. Thanks in advance for any help.


$mailcontent = "Order#: ".$orderid."\n"
."Date Y-M-D: ".$date."\n"
."Sale Total: $ ".$total_sale."\n"

for ($p=0; $p<$num_results; $p++){
$itemNum = stripslashes($row[&quot;itemNum&quot;]);
$item = stripslashes($row[&quot;item&quot;]);
$quantity = stripslashes($row[&quot;quantity&quot;]);
.&quot;Item#: &quot;.$itemNum.&quot;\n&quot;
.&quot;Items: &quot;.$item.&quot;\n&quot;
.&quot;Quantity: &quot;.$quantity.&quot;\n&quot;
}
.&quot;First Name: &quot;.$firstName.&quot;\n&quot;
.&quot;Last Name: &quot;.$lastName.&quot;\n&quot;
.&quot;Address: &quot;.$address.&quot;\n&quot;;
 
<?php

$full_string = &quot;&quot;;

for($i=0; $i < sizeof($pieces_of_string_array); $i++ ) {

$full_string .= $pieces_of_string_array[$i];

}

?>


OR:


<?php

for($i=0; $i < sizeof($pieces_of_string_array); $i++ ) {

$full_string = $full_string . $pieces_of_string_array[$i];

}

?> My Work...
...and More...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top