bschultz Posted July 11, 2011 Share Posted July 11, 2011 I'm trying to print the results of an array inside an email message. It's working...accept that it prints the word Array before the values of the array. <?php $sql8 = "SELECT first_name, last_name, ump_id FROM ump_names WHERE `ump_id` IN (SELECT ump_id FROM scheduled_umps WHERE `game_id` = '$_SESSION[game_id_number]')"; //echo "$sql8<br />"; $rs8 = mysql_query($sql8,$dbc); $umps[] = array(); //while($row8 = mysql_fetch_array($rs8)) //{ //$umps[] = "$row8[first_name] $row8[last_name]."; //} while($row8 = mysql_fetch_array($rs8)){ $umps[] = "$row8[first_name]" . " " . "$row8[last_name]"; } $valuesgdf = implode(', ', $umps); // this sets the headers and other info for the email $headers = "From: $_SESSION[association_name] \n"; $headers .= "Reply-To: $_SESSION[association_name] \n"; $subject = "There has been a change in your $_SESSION[association_name] Schedule"; $message = "Here is the info for this date: \n\n Date - $day \n Game - $visitor at $home \n Start Time - $start \n GAME NOTES - $notes \n SCHEDULED OFFICIALS - $valuesgdf"; //this sends"SCHEDULED OFFICIALS - Array name1, name2, name3 etc" in the email... ?> How do I get "Array" to not show up prior to $valuesgdf? Thanks. Link to comment https://forums.phpfreaks.com/topic/241621-array-results-in-email-message/ Share on other sites More sharing options...
.josh Posted July 11, 2011 Share Posted July 11, 2011 change $umps[] = array(); to $umps = array(); You are initializing an array as first element of an implied array ($umps), instead of just initializing $umps itself as an array. Link to comment https://forums.phpfreaks.com/topic/241621-array-results-in-email-message/#findComment-1241036 Share on other sites More sharing options...
bschultz Posted July 11, 2011 Author Share Posted July 11, 2011 That did it...thanks! Link to comment https://forums.phpfreaks.com/topic/241621-array-results-in-email-message/#findComment-1241041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.