Reputation: 3225
I have a variable ($email_body
) which has the body of an email in it. just before this variable i am running this PHP:
$sql3="SELECT * from billing_pdf_archive where sequence = '".$result["sequence"]."' ";
$rs3=mysql_query($sql3,$conn);
while($result3=mysql_fetch_array($rs3))
{
$invoices_list_data[] = $result3["invoice_number"];
}
$invoices_list = implode('<br>',$invoices_list_data);
i want to make it list all the rows found (invoice_number
column) in the $email_body
variable
so i have tried:
$email_body = $invoices_list;
but its only displaying one row
how can i do this?
Upvotes: 1
Views: 51
Reputation: 12149
I think your problem probably lies in debugging the query. First try and debug your code step by step.
$sql3="SELECT * from billing_pdf_archive where sequence = '".$result["sequence"]."' ";
echo $sql3;
The above should output your sql statement. Something like
SELECT * FROM billing_pdf_archive WHERE sequence = 'val'
Try connecting to your database and running it in mysql query browser. Does it return multiple results? If so continue to next step.
$rs3=mysql_query($sql3,$conn);
while($result3=mysql_fetch_array($rs3))
{
var_dump($result3);
$invoices_list_data[] = $result3["invoice_number"];
}
The above should output values. If it does then you are on your way to next step. Your implode should join the values up.
Upvotes: 1