Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:53:02+00:00 2026-06-11T09:53:02+00:00

i am using the following query:- $qry=mysql_query(SELECT item,quantity,price,(quantity * price) as total FROM saleitems_T

  • 0

i am using the following query:-

$qry=mysql_query("SELECT item,quantity,price,(quantity * price) as total FROM saleitems_T WHERE invoice = '$inv' ");

i am trying to use the while loop inside the mail body but it does not work. following is the code.

$to="someone@somewhere.com";
$headers="Content-type: text/html\r\n";
$body = '
<html> <body>
Invoice details are as follows.<br />
'.while($row = mysql_fetch_array($qry)){
echo "<table><tr><td>";
echo $row['item'];
echo "</td><td>";
echo $row['quantity'];
echo "</td><td>";
echo $row['price'];
echo "</td><td>";
echo $row['total'];
echo "</td></tr>";} .'
</table></body></html>';

mail($to,$body,$headers);

the no of lines retrieved varies on each invoice. Now i want to send the results as an email. any help with sample code would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:53:03+00:00Added an answer on June 11, 2026 at 9:53 am
    $to = "someone@somewhere.com";
    $headers = "Content-type: text/html\r\n";
    $body = '<html><body>Invoice details are as follows.<br />';
    foreach( mysql_fetch_array($qry) as $v ) {
    $body .= "<table><tr><td>{$v['item']}</td>"    
             . "<td>{$v['quantity']}</td>"     
             . "<td>{$v['price']}</td>"  
             . "<td>{$v['total']}</td></tr></table></body></html>";       
    }
    
    mail($to,$body,$headers);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following query: $search = mysql_query(SELECT * FROM `users` WHERE username LIKE
I'm using the following query to select users from my 'users' table with the
I am using the following query to select wait times from the table wait_times
i've been using the following query: select LEN(columnname) as columnmame from dbo.amu_datastaging This works,
I am using following query to find gender of app user. q=select gender from
I am trying to create a histogram data using following query: SELECT FLOOR(Max_Irrad/10) AS
Using the following query: SELECT title, nid, created FROM node WHERE uid = $account->uid
Using the following query, WITH cteTest (Employee_ID) AS ( SELECT employee_ID FROM pep.dbo.labor_ticket )
I have one query I am using following query to select record from MySQL
I'm using the following query: SELECT message,timestamp FROM botlogs.tbllogs WHERE message like '%Failed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.