Note that there are some explanatory texts on larger screens.

plurals
  1. POArray variables are showing as "Array" in PHP email
    primarykey
    data
    text
    <p>I have the following PHP script that queries the database for certain fields and then should take the fields as variables and send an HTML formatted email using those variables. The email should loop and send an email for every issue. The problem that I am having is that I get the email but the variables just say "Array" and only one email is sent. Here is my script:</p> <pre><code>&lt;?php $serverName = "SERVER"; //serverName\instanceName // connection will be attempted using Windows Authentication. $connectionInfo = array( "Database"=&gt;"DB"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.&lt;br /&gt;"; }else{ echo "Connection could not be established.&lt;br /&gt;"; die( print_r( sqlsrv_errors(), true)); } //begin sql statement $tsql = " select ji.pkey, ji.summary, cfo.customvalue, ji.resolutiondate from jiraschema.customfieldvalue cfv left outer join jiraschema.customfieldoption cfo on cfv.STRINGVALUE = cfo.id inner join jiraschema.jiraissue ji on cfv.issue = ji.id where cfv.CUSTOMFIELD = 10252 and ji.issuestatus = 10002 and ji.RESOLUTIONDATE &gt; '2013-09-18' order by ji.pkey"; //call the query $query = sqlsrv_query($conn, $tsql); if( $query) { echo "Statement executed. \n"; } else { echo "Error in statement execution. \n"; die(print_r( sqlsrv_errors(), true)); } while( $row = sqlsrv_fetch_array( $query)){ $pkey[] = $row['pkey']; $summary[] = $row['summary']; $customvalue[] = $row['customvalue']; //$clientEmail[] = $row['clientEmail']; $email_from = 'xxx@xxx.com';// update the email address $email_subject = "Follow Up on $pkey"; $email_body = '&lt;html&gt; &lt;body&gt; Dear ' .$customvalue.', &lt;br&gt;&lt;/br&gt; In response to your recent call to our support department, your ticket ' .$pkey. ' shows that it has been resolved. Please let me know if you need any additional assistance with this issue. If the issue has been completely resolved to your satisfaction, we will close the issue. &lt;br&gt;&lt;/br&gt; Thank you for contacting our support department. We hope we brightened your day! &lt;/body&gt; &lt;/html&gt;'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = 'xxx@xxx.com'; $headers .= "From: $email_from \r\n"; $headers .= "Reply-To: $to \r\n"; //Send the email! if (mail($to,$email_subject,$email_body,$headers)) { die('Mail Sent!'); } else { die('Error:Delivery Failed!'); } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload