PHP simple text email and including mysql database info

php , email , mysql , array , loops London, United Kingdom
  • 11 years ago

    Hi all. I am trying to input the data from a (paypal) mysql database into a simple text email to the customer to confirm the items and quantities they have purchased. This is easy to produce in an HTML table ... but I am finding it impossible to extract the data in a form that is suitable for a simple text email. The code at present looks like this:

    $myDataID = mysqlquery("SELECT paypalcartinfo.itemname, paypalcartinfo.quantity FROM paypalcartinfo WHERE paypalcart_info.txnid = '$txnid'", $connectID) or die ("Can't read the this record.";

    print "

    \n"; print ' Itemname Quantity '; while ($row = mysqlfetchrow($myDataID)) { print ''; foreach ($row as $field) { print ''.$field.''; } print "\n"; } print '';

    Your thoughts on how to overcome this problem would be greatfully received - as it's driving me bonkers! My thoughts up to now have centred around trying to turn each piece of table date (from the array) into individual variables .. but this path seems hopeless unless someone can come up with a solution. Many thanks in anticipation. Cheers.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe