Send An Email With The Results From A Database Query?

Apr 5, 2010

I would like to send an email with the results from a database query.  What I have written works, but it sends a separate email for each match.  I would like ALL matches in ONE email.

Here's the code

Code: [Select]$sql = "SELECT * FROM calendar WHERE WEEK(date) = WEEK(DATE_ADD(NOW(), INTERVAL 1 DAY)) AND home = 'schoolnamehere'";
$dbq = mysql_query($sql,$dbc);
while ($row = mysql_fetch_array($dbq)) {


Now, I know why it's doing what it's doing.  The call to MAIL is INSIDE the while loop.  The problem is, I can't figure out where to put the call to MAIL and where to put the query, and still have it work.


Send Query Results As A List In Email?

Jun 18, 2010

I am trying to send the results of a mysql query as a list in an email. If I use the same code to print the results using echo it works fine, but I cant Figure out how to send them in an email listing them the same as it does when using echo (showing results). The Problem is that $services are not listed in the email. It shows one row of results only. NOTE: $services are in the middle of the message. Here is the code I have .

PHP Code:

$query = "SELECT * FROM inv_services WHERE invid = '$invid'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {


What I need is for the same output as the above code produces to be in the email in the place I have $services (in the $message = "")

View 14 Replies View Related

Send Query Results As A List In Email...?

Jun 17, 2010

I am trying to send the reults of a mysql query as a list in an email. If I use the same code to print the reults using echo it works fine, but I cant Figure out how to send them in an email listing them the same as it does when using echo (showing results not emailing). The Problem is that $services are not listed in the email. It shows one row of results only. NOTE: $services are in the middle of the message.  Here is the code I have .

$query = "SELECT * FROM inv_services WHERE invid = '$invid'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {


View 2 Replies View Related

Create Form And Send Results To Email Address?

Sep 3, 2009

create a form & send the results to my e mail address?? and cc as well to another one? Field Names : Name , Telephone No (should get validated to c the user enters more than 10 numbers) , E Mail address (should get validated to c whether the user has entered a correct e mail format) , Radio button, and commens area. Submit & reset buttons.We need to make sure that certain feilds such as name , comments cant keep "blank"

View 4 Replies View Related

Send Results From An Html Form To An Email Address?

Nov 2, 2009

I need to send results from an html form to an email address.Here is my html

<form action="<?php echo $PHP_SELF;?>" method="post">
<b>Describe Yourself<br /></b>
1) Question 1:<br />

View 14 Replies View Related

Send Query Through Email?

Jun 27, 2011

I've been search for 2 weeks now how to send a query result in an email. I know how to do a simple putting the query into a html table and send it using $message .= blablabla. but what i'm looking for is little bit complicated. I have a table function and call it every time I need to use it rather than create table and <tr><td> and put it into the message body. I don't know how to put the table function into the message body and send through email. here's the code:


The rest is in the attachment.

View 2 Replies View Related

Sending Results Of A SQL Query Via Email

Apr 20, 2010

I am attempting to query a database and send the results in table format via email (so I assume in HTML). I can query the table correctly and display the information but how do I now send it

So far:

$con = mysql_connect("*****","*****","*****");
if (!$con)
die('Could not connect: ' . mysql_error());


View 9 Replies View Related

Sending Results Of An SQL Query Via Email?

Apr 20, 2010

I am attempting to query a database and send the results in table format via email (so I assume in HTML). I can query the table correctly and display the information but how do I now send it - if at all possible???
So far:

$con = mysql_connect("*****","*****","*****");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("*****", $con);


View 3 Replies View Related

Send Form Results To An Email Address Based On What The User Selects From A Menu?

Oct 23, 2006

How can I send form results to an email address based on what the user selects from a menu? Here's the HTML code:


<select name="Company" class="text" style="width:170px;" value="0">
<option selected>- Select Company -</option>
<option value="a" selected>A</option>


View 4 Replies View Related

Bold - Email And Web Links In Mysql Query Results In Table?

Nov 1, 2009

have a simple membership database in mysql. Running a query, and displaying results on a page to show active members. Need some simple assistance - I want to bold the names, and make the email address links (- mailto: etc.), and make links to folks web sites, if present.

PHP Code:

$result = mysql_query("SELECT * FROM members where dues > '2009-05-01' and nowebsite <> 'x'");
echo "<table border='0'>
<th></th> </tr>";
while($row = mysql_fetch_array($result))


View 4 Replies View Related

Send Email - Page Where You Enter An Email Address And Click Send.

May 30, 2005

I am interested in creating an "email -this" type ability for a website. I am sure most people have seen an "email -this story" type link that is standard on most news web sites. You click such a link and then it takes you to a page where you enter an email address and click send. The link for the story and the title are not editable. Does anyone know where I can find example code of how to do this with php, and any explanation of how this works.

View 1 Replies View Related

Send The Data To The Mysql Database As Well As Send An Email To The Email Address

Mar 16, 2011

This code is supposed to pull data from a mysql database so I can edit it. that part works. The other part of this code is, it's supposed to send an email to an email address based off of the "location" field. If I choose "Office1, it will send the data to the mysql database as well as send an email to the email address in listed for office1 with the data that went to the mysql database. Can someone take a look & correct my code issues?
Code: [Select]<p> To go to the main page <a href="http://tnep-g-psrflow/flow/index.html">click here</a>.</p>
<?php # edit_dqa.php
$page_title = 'Edit a Record';
$con = mysql_connect("localhost","uname","password");
if (!$con)
die('Could not connect: ' . mysql_error());

View 2 Replies View Related

Send Email Via Cronjob And Set Amount Of Email Send Per Mins?

Oct 19, 2009

i have a program which use to send group emails, i set a cornjob per mins for this program, and set execute per 2nd/min, and check if the now time is match to my defined schedule time in db. if true the program will run and send email, else nth...

the problem is i want to dynamic set the amount of email sending per mins by user, let say i have 10000 emails to send, and i want to send 3 emails per min, something like that, but i cant find the way when using cronJob, (set cookie? record the current email to db?),
since i found that if i use sleep(), it will cause php execute limit error...

how to do that?or using other method to do schedule task? pear?if using other methods, can show how to use it briefly ?

View 3 Replies View Related

Sending HTML Email Results In Email Displaying HTML Source (Codeigniter Email Class)

Jun 8, 2011

I am having problems with email sent via the email class in Codeigniter displaying the source HTML code in the email message instead of the rendered HTML view. For testing, I am currently having CI on XAMPP on Windows, and using Gmail SMTP to send to the same gmail address.

The function that sends the email is as follows:

$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://',
'smtp_port' => 465,


how to get HTML emails sent to be rendered instead of displaying its source code?

View 1 Replies View Related

Results On Multiple Pages: Storing Search Results Or Query Again

Nov 15, 2005

Suppose I have a search result with different pages. I could store the results and get them out of the database with a simpler query for the next page. Or I could query again and display only a portion of the results (eg from 20-30). What would be the most efficient. How would bulletin boards do this, or google?

View 2 Replies View Related

Ordering Mysql Query Results - Calculate Results And Order?

Jul 11, 2010

i have two tables called teams and results and basically the the results table will store the results of each match the team has. what i need to do is when i select all the teams i need the team with the most results to be ordered first and descending from there.

man united   12 pts
liverpool       9 pts
etc etc

the tables im using are below if anyone could tell me the best way of calculating the results and ordering them


View 8 Replies View Related

How To Send Email Automaticly To Admin When Users Send A Form?

Oct 3, 2005

how to send email automaticly to admin when users send a form....example...a booking form..therefore the admin will alert of the booking..

View 2 Replies View Related

SEND Button To Send Form To Email Address

Apr 1, 2011

Im basically one of those guys who uses a WYSIWYG, clicks on View Source, then edits pathways and things like that. That is the extent of my HTML-PHP knowledge. I was told that someone who knows PHP could do this very easily, so I'm hoping someone here will be generous enough to give me a few minutes of there time to edit my code.

I have a simple online application form. I simply want the SEND button to send the form to my email address, and then take the user to a "thank you" page. I originally used pForm to create the form.  The site is hosed through Go-Daddy. 

Code: [Select]<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pre-Approval Form</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>
<body id="main_body">

View 3 Replies View Related

Email Form Results - Results Emailed

Aug 30, 2003

I have a form and I need the results emailed to me how would I be able to do this.

View 2 Replies View Related

Make An Email Form Send The Email To A Different Recipient Based On Radio Tick Box

Jun 2, 2009

A client has asked me to create an email form where depending on which tick box is ticked the email is sent to a different email address.

For instance:Code:I would like to know more about: [] Cars [] Trucks [] Vans When 'cars' is ticked the email is sent to '', when 'trucks' is ticked to [URL]...

Is this a fairly easy thing to do? Can someone help me on the way (bearing in mind I have very limited php skills :-)?

View 5 Replies View Related

Create A Script That Users Can Specify An Email And Send A User A Pre-defined Email?

Feb 21, 2011

basically, I'm creating a page where a user can visit, and enter in the following information:

1. Their First Name
2. Their Email
3. Recipient's Email

They then can send a pre-defined email, saying something like the following...

"Hello, {Recipient's email}. {First name} ({Email}) has just sent you a slurp! You can ignore this message, or slurp them back.
[Slurp Them Back] [Slurp Someone Else] [What's A Slurp?]"

The whole part about the Slurp is something that doesn't really matter, it's just the text from the pre-defined email. The text in {...} is taken from the fields on the page, and the text in [...] are just links.

View 4 Replies View Related

Force Email Programs To Show Images Send In Html Email ?

Mar 26, 2010

I am sending an html email with php and it includes an image. Some email programs, such as gMail have a 'display images' button. The user has to click on that in order for the images in the email to show up.Is there any way I can force email programs to show images that are sent within html emails generated by php?

View 6 Replies View Related

Email Notification - Set When 5 Days Remaining To An Expiry Date And Send Email

Oct 9, 2009

I m building an email notification that admin will set an expiry date and when 5 days remaining to an expiry date,an email should be sent to that user.. Have you understand what i wanna say?

View 12 Replies View Related

Send Email From Website Contact Forms To GoDaddy Email Accounts

Nov 3, 2009

I have a simple PHP contact form located here: [URL]... I have the form configured to send the email to a specific email address for my client. The form was working fine when I had their email accounts hosted on my server. But ever since we switched the email hosting to GoDaddy, they are not getting any of the mail coming from the contact form. They are allowed to send / receive any other emails. And when I configure the form for just my email account to receive the message, I can get it just fine. This is a really odd problem. Does anybody have any ideas? Has anyone ran into this problem before on a hosted GoDaddy email account? I called GoDaddy and they say that it's not their problem.

View 2 Replies View Related

Script Should Send An Email Containing Form Submission Values But No Email Is Getting Sent?

Apr 4, 2011

So I have a HTML form with some PHP but I'm not getting any email whatsoever after submitting it. I can't find the problem! can you help me out? Tried changing the if(isset($_POST['submit'])) { to 'enviar' but still not working. tried putting some echos to see where it's not working. the only statement that is stopping at the else statement is stripslashes.

The form snippet:

<div id="contact-wrapper">
<?php if(isset($hasError)) { //If errors are found ?>
<p class="error">Please check if you entered valid information.</p>
<?php } ?>


View 3 Replies View Related

Email - Mailer Script - Send The Name And Email Address That Is Captured?

Mar 17, 2010

when it comes to PHP and have a script that emails the contents of a form. The trouble is it only sends me the comment when I want it to also send the name and email address that is captured.

how I can adjust this script to do this?

function valid_email($str)

View 3 Replies View Related

Send A Message / Email To External Email Recipients From A Web Form?

Feb 26, 2009

if there is a script that will allow a person to send an email to other external email addresses that are input by the user? For example, I am designing sports sites where I want the coach to go to his team website and fill out a form with subject/topic text box and then a text box/message area while also separately inputting the email addresses the message should go to (e.g. - game is cancelled today and then hit send). The "send to a friend" scripts have the spirit of what I need, but I don't want to limit the # of email addresses to send to and I only want the message delivered, not canned text "recommending the site....".

View 2 Replies View Related

Email Posting (like Posterous) - Send Emails To The Unique Email

Mar 24, 2011

I have a small web app to which users upload photos. I want to let them email in their photos (from their iPhones/Android phones) and a number associated with that photo. It'd be kind of like posterous but only allow emails with one photo and one number.

I see two ways, but I'm not sure if I'm even close.

1) Have one email (like Posterous) that users send mail to, then send to it from the same email that their account is under.

2) Have a unique email for every user that they can email to. (But this has the problem that anyone could send emails to the unique email.)

View 2 Replies View Related

Send An Email Using Mail() Function To A Yahoo Account The Email?

Mar 2, 2009

why is that when I try to send an email using mail() function to a yahoo account the email is considered as spam

View 4 Replies View Related

Paginating Query Results - Can't Get All Results From Database

Dec 28, 2009

I am trying to Paginate Query Results. The values are passed through a form allowing users to search a database based on certain criteria they select. Now I got two problems though,

1) I can't get all the results from the database(as not all the criteria is working) ?

2) If there is more than 1 page, the next page does not carry over any more results, its just blank even though there should be more results. Here is my code:


View 3 Replies View Related

JQuery - AJAX - Send An Email When The User Fills In The Newsletter Subscription Test Field With Their Email Address

Apr 22, 2011

There are no errors, or warnings, just a blank page. I am trying to send an email when the user fills in the newsletter subscription test field with their email address, and when you click submit, the page refreshes! (1st problem) and it fails to display anything on the page (second problem), all you see is just a blank page. No emails were received. I've tested the email script separately, which works fine. I've been using for months with different sites so I know it works. I've tried changing things around in jQuery etc but nothing has helped fix this problem.

$(function() {
var txt = $('.email').val();
$.ajax({url: 'index.php',
type: 'post',
data : { email: txt },
success: function(data) {

View 2 Replies View Related

Send Email To Email Addresses Stored As Variables?

May 24, 2009

I'm new to the forum and was wondering if anyone Basically, I'm trying to create a script that will send an email to a group of recipients that are created elsewhere, plced in mysql database and then recalled and added as a variable to which the email is sent. The problem I have is that I'm unsure how to get the email addresses from the database. I've put a bit of code below. The idea is that the email addresses are taken from the db. This doesn't work. the email will go to the example address. How can I assign the email addresses from the db to individual variables?

$query = "SELECT * FROM townfield"; 
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['email'];
echo "<br />";}    
if($fao == "1") {
$attention = "All Staff";
$recipients = $row['email'] . "," . "";}

View 4 Replies View Related

Send A Html Email Using Forum Mass Email?

Sep 30, 2007

Send a html email using my forum mass email option, but every time i send it nothing shows up in the email but a bunch of source code.THIS IS MY SOURCE CODE.

<style type="text/css">
style3 {font-family: arial}


View 9 Replies View Related

Grab Email Addresses From MySQL And Send An Email....

Aug 25, 2007

I am making a simple mail form that will SELECT email address from a MySQL table based on the userid of the person sending the email.

if (isset($_POST['submit'])) {
$result = mysql_query("SELECT * FROM emailList WHERE merchantId = '".$_SESSION['id']."'") or die(mysql_error());

What would be the most efficient way of storing the email addresses from MySQL (may be 1 or may be 100) and then sending them in BCC to all the people gathered from the MySQL table?

View 4 Replies View Related

Send A Mass Email From A Database Of Email Addresses

Jul 3, 2007

Im trying to send a mass email from a database of email addresses. basically, once a user signs up, their email is inserted into  table in the database. I would liek to make a link that i can click form the backend that says "send out newsletter" this would take all the emails in the database and put them in outlook ( mail app for me), seperate each with a comma and then i could compose a message. here's what i have come up with so far..
//Once connected to database

$mailto = mysql_query("SELECT * FROM newsletter");
while($row = mysql_fetch_array($mailto))
echo "<a href=">. $row['email'] ."/">Send out Newsletter</a>";

Ive had it working but obviously it s making each email a seperate link that says "send out newsletter" i would like it to be one link that combines all the emails in a "mailto:" format.

View 1 Replies View Related

Send An Email With A Link To Verify That The Email Is From The User?

May 5, 2010

when people sign up they have to give an emailaddress. I want to send an email to that address with the question to click a link to make sure that emailaddress belongs to the do i do that?

View 1 Replies View Related

Send An Auto Email To A Variable Email Address?

Oct 7, 2010

I am trying to send a auto email to a variable email address throught php. But im not sure how to do it? I think this is the kind of php code I have to use:

$to = "<?php echo $Adminmail ?>";
$subject = "Join Faction Request!";
$message = "<?php echo $user wishes to join your faction?>";
echo "Mail Sent.";

Also how would i send php code in the email?

View 2 Replies View Related

Adding Results From Query 2 To Query 1 - Cannot Use Object Of Type Mysqli_result As Array

Apr 29, 2011

I make two queries and I'd like to add rows from query 2 to query 1. Also, suppose getResult1() returns no column called "item2"

$result1 = getResult1();
$result2 = getResult2();
foreach ($result2 as $res)


There error I get here is on line

$result1[] = $data

and reads

Fatal error: Cannot use object of type mysqli_result as array

I think I get what is happening, but I'm not quite sure how to fix it.The rows are ultimately getting converted to JSON, and I can do that that with an array of arrays.I've fixed the problem by converting $result1 into an array of arrays. I do this using a while loop and a fetch_array() call, but is there a quick way to just convert $result1 into an array of arrays instead of a record set?

View 3 Replies View Related

Trouble With Join Query's, Query Just Dosent Produce Results

Jul 17, 2005

I have the following code which I am having difficulty getting to
work. I think it may be a problem with the $got query that is being
run as if I set that to a set value then my site seems to run ok, but
I also have checked the data whichi is being held in $detailsrow[1] by
echoing them and it is perfect. I have also sutstituted the values and
ran the query in mysqql directly and it gives me the exat results I am

Ive been on it for hours now and I cant get it to work so any help
will be fantastic,

<select name="type">
$mod = ("select name from modules");
$modnames = @mysql_query($mod);
$getfulltype = ("select from modules, devices where
modules.code= $detailsrow[1] and devices.type = $detailsrow[1]");
$got = mysql_query($getfulltype);
while($row = mysql_fetch_row($modnames))
if ($got == $row[0])


echo ("<option selected value="$got">$got</option> ");

else {
echo ("<option value="$row[0]">$row[0]</option>");

View 10 Replies View Related

Execute An Update Query Based On The Results Of A Select Query

Mar 1, 2007

I'm trying to execute an update query based on the results of a select query... This doesn't work - any ideas? This is the code I'm trying to get to run (it updates all products which are set to arrive by a certain date if that date has arrived or passed - and there are products that should and should not be updated in the db this is being tested with...): Code:

View 7 Replies View Related

Send Email From Application To A Local Email?

Jun 15, 2010

I have a local network in the company with a mail server, how can i make php application built locally on the server to send and email to a local email address?

View 2 Replies View Related

Send Email After Redirecting On A Page Name Email.php

Nov 24, 2010

i want to send email after redirecting on a page name email.php or it may be anything.when i redirect on this page amal should be send to user automatically.

View 4 Replies View Related

Send An Email Then Add A Template Design In The Email?

Sep 14, 2010

How can I send an email using php then add a template design in the email? I'm using this:

$to = "";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "";
$headers = "From: $from";
echo "Mail Sent.";

And it works fine! The problem is just how to add a template.

View 3 Replies View Related

Send An Email From Yahoo Email By Using Curl

Jan 25, 2011

You know facebook has an API. so, my site's users can login with their facebook accounts on my website.

Does yahoo have an API like facebook? Did anyone see a yahoo API? Ive been looking for a yahoo API for 5 hours, i cannot find it. I wanted to ask this question here , because there are so many php coders here, and someone maybe tried it before.

Id like my site's users to login to their yahoo account and send mail from their account. I wanna use php curl function, or anything elses..

I found this code block:


However i was not able to connect my yahoo account and send an email..

View 1 Replies View Related

Send Email From Localhost To Other Email Accounts?

Jun 8, 2009

I'm trying to create a function to send email from localhost(postmaster@localhost) to other email ccounts(yahoomail,gmail,hotmail).I'm currently using xampp and the mercury32 inside xampp.I had uccessfully sent email from localhost to localhost but I can't make it to send outside from localhost. This is the code and it works perfectly sending email from localhost to localhost.

//Check whether the submission is made

View 6 Replies View Related