473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

e-mail contents of mysql databse NOT

I have have tried to find the answere to this on line but without success!

I have a table called cart. In cart I have a column called ID. What I need
to do is take this code:

<?php

$result = mysql_query("SELECT * FROM cart WHERE cartId='$ID'");

bla bla bla

<?php echo $row["ItemNo"]; ?>
</font></td>
<td width="22%" height="6"><font face="verdana" size="2" color="red">
<?php echo $row["Name"]; ?>
</font></td>
<td width="14%" height="6">
<div align="center"><font face="verdana" size="1" color="black">
<?php echo $row["Quantity"]; ?>
</font></div>
</td>
<td width="7%" height="6" > </td>
<td width="10%" height="6" >
<div align="left"><font face="verdana" size="1" color="blue"> $
<?php echo number_format($row["Price"], 2, ".", ","); ?>
</font> </div>
</td>
<td width="7%" height="6">
<div align="left"><font face="verdana" size="1" color="blue">
<?php
$Cost += ($row["Quantity"] * $row["Price"]);

?>
<?php
$ItemCost = ($row["Quantity"] * $row["Price"]);

?>

bla bla

and somehow e-mail it to the client.

I would like to use the mail() function but can't seem to get $message= to
accept it.

IS there a way to do this. If not how do I e-mail the contents of
cartId='$ID to the client to process.

I'm new at this and fumbling my way through. Any suggestions would be
appreciated.

Thanks

Michael
Jul 17 '05 #1
3 1726
de Beers wrote:
I have have tried to find the answere to this on line but without success!

I have a table called cart. In cart I have a column called ID. What I need
to do is take this code:

<?php

$result = mysql_query("SELECT * FROM cart WHERE cartId='$ID'");

bla bla bla

<?php echo $row["ItemNo"]; ?>
</font></td>
<td width="22%" height="6"><font face="verdana" size="2" color="red">
<?php echo $row["Name"]; ?>
</font></td>
<td width="14%" height="6">
<div align="center"><font face="verdana" size="1" color="black">
<?php echo $row["Quantity"]; ?>
</font></div>
</td>
<td width="7%" height="6" > </td>
<td width="10%" height="6" >
<div align="left"><font face="verdana" size="1" color="blue"> $
<?php echo number_format($row["Price"], 2, ".", ","); ?>
</font> </div>
</td>
<td width="7%" height="6">
<div align="left"><font face="verdana" size="1" color="blue">
<?php
$Cost += ($row["Quantity"] * $row["Price"]);

?>
<?php
$ItemCost = ($row["Quantity"] * $row["Price"]);

?>

bla bla

and somehow e-mail it to the client.

I would like to use the mail() function but can't seem to get $message= to
accept it.

IS there a way to do this. If not how do I e-mail the contents of
cartId='$ID to the client to process.

I'm new at this and fumbling my way through. Any suggestions would be
appreciated.

Thanks

Michael


Rather than use this interweaving of html and php, which is very common,
but I personally find as readable as a plate of spaghetti, build up a
string that contains what you want to display, then echo that variable
to display the page... ie it contains all the hml as well as the php
vars you use. That can then become the basis for your message.

eg...

<?php
$Message = '$row["ItemNo"]';
$Message .= ' </font></td>';
$Message .= '<td width="22%" height="6"><font face="verdana"
size="2" color="red">';
$Message .= $row["Name"];
$Message .= '</font></td><td width="14%" height="6">';
$Message .= '<div align="center"><font face="verdana" size="1"
color="black">';
$Message .= $row["Quantity"];
$Message .= '</font></div></td>';
$Message .= '<td width="7%" height="6" > </td>';
$Message .= '<td width="10%" height="6" >';
$Message .= '<div align="left"><font face="verdana" size="1"
color="blue">';
$Message .= number_format($row["Price"], 2, ".", ",");
$Message .= '</font> </div>';
$Message .= '</td>';
$Message .= '<td width="7%" height="6">';
$Message .= '<div align="left"><font face="verdana" size="1"
color="blue">';

$Cost += ($row["Quantity"] * $row["Price"]);
$ItemCost = ($row["Quantity"] * $row["Price"]);

$Recipient = "st***@my.email.address";
$Title = "Email title " . date ("d-M-Y");
$Message .= "Mail Message";
mail ( $Recipient, $Title, $Message );

echo $Message;
?>
Jul 17 '05 #2
What you are doing is <?php echo .....; ?> and therefore outputting it
on the screen.

Just declare a $message in the beginning of the script and then extend
the $message variable with $message .= "bla di bla di bla";

Then call the mail-function where the body parameter is your $message.

Mark

de Beers wrote:
I have have tried to find the answere to this on line but without success!

I have a table called cart. In cart I have a column called ID. What I need
to do is take this code:

<?php

$result = mysql_query("SELECT * FROM cart WHERE cartId='$ID'");

bla bla bla

<?php echo $row["ItemNo"]; ?>
</font></td>
<td width="22%" height="6"><font face="verdana" size="2" color="red">
<?php echo $row["Name"]; ?>
</font></td>
<td width="14%" height="6">
<div align="center"><font face="verdana" size="1" color="black">
<?php echo $row["Quantity"]; ?>
</font></div>
</td>
<td width="7%" height="6" > </td>
<td width="10%" height="6" >
<div align="left"><font face="verdana" size="1" color="blue"> $
<?php echo number_format($row["Price"], 2, ".", ","); ?>
</font> </div>
</td>
<td width="7%" height="6">
<div align="left"><font face="verdana" size="1" color="blue">
<?php
$Cost += ($row["Quantity"] * $row["Price"]);

?>
<?php
$ItemCost = ($row["Quantity"] * $row["Price"]);

?>

bla bla

and somehow e-mail it to the client.

I would like to use the mail() function but can't seem to get $message= to
accept it.

IS there a way to do this. If not how do I e-mail the contents of
cartId='$ID to the client to process.

I'm new at this and fumbling my way through. Any suggestions would be
appreciated.

Thanks

Michael

Jul 17 '05 #3
You could also try:

1) ob_start();

2) echo your table out in html

3) $contents = ob_get_contents();

4) ob_end_clean();

5) $filename="/path/file.html"; $fp=fopen($filename,"w");

6) fputs($fp, $contents); fclose($fp);

7) passthru("htmldoc -f attachment.pdf --left .75in --right .75in --top
..2in --bottom .2in --linkstyle plain --linkcolor black --footer . --webpage
$filename");

8) Use Mutt to mail it out:
passthru("/usr/local/bin/mutt -F /path/to/mutt/conffile/muttrcconffile -a
/path/attachment.pdf -s \"Email From You\" $emailaddress <
/path/emailbodytext.txt");

Then your client gets his email in a pdf attachment! htmldoc will let you
embed links into that pdf, too.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rw3iss | last post by:
Alright, I'll get to the point. I'm totally new to MySQL databases and PHP, but I can make nice webpages none the less. Basically, I need to learn how to create a webpage that searches a MySQL...
5
by: sifar | last post by:
Hi, This is my first post to this Group. A] I am trying to create a escalation page which will mail an escalation report of a faulty product. Items needed on Page: -----------------------
8
by: John Scott | last post by:
I want to be able to put into the body of an email, the entire contents of a aspx page....with form fields filled out I know I could go through and get the values of all of the textboxes, radio...
6
by: AP | last post by:
I have not seen any good examples on how to connect to a mySQL db. My website uses phpMyAdmin to administer the SQL databases. What confuses me is where are the databases that I create located? For...
74
by: John Wells | last post by:
Yes, I know you've seen the above subject before, so please be gentle with the flamethrowers. I'm preparing to enter a discussion with management at my company regarding going forward as either...
1
by: glenn | last post by:
I am try to teach myself PHP and MYSQL. Below I have a php file I have created which when i look at it in a browser returns a nice list of people and there addresses. When I change the $data...
10
by: farukcse | last post by:
Dear Sir, i am facing a encoding problem with MySQL data base and phpMyAdmin. i developed a form . From wher user can insert the Car plate No. to the MySQL database.Both of the php file for...
2
by: gnawz | last post by:
Dear experts I need help on how to notify users in a website when some one else logs in or when a record has gone into the database. Something like a pop-up or sound beep can someone help?
0
by: impin | last post by:
i need store the details of a hike in salary details into the database. if its employee's first hike, then i have to insert the employee hike details. for second hike, third hike and so on means,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.