Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mail a whole mysql query to the recipient obtained from the query

Posted on 2011-03-13
7
Medium Priority
?
287 Views
Last Modified: 2013-12-13
Though I got really good responses to my questions, I still need more...
Please how could I send the whole query to the recipient obtained from the query
I cannot enter the email of the recipient in the script as  the recipient changes according to the query
so far this is what I have done thank to the previous replies you gave me
What I really want is to click send and the whole query is automatically send to the recipient
whose email is on the query results
Thanks for your great help
<h1>Please confirm the reception of this email and the acceptance of the job/s below:<br />Information for</h1> 	 
      <?php
$term = $_POST['term'];
$term1 = $_POST['term1'];

mysql_select_db($database_languageLinks, $languageLinks);
$query_languageLinks = "SELECT * FROM jobs WHERE Job LIKE '%$term%' AND Let LIKE '%$term1%'";
$languageLinks = mysql_query($query_languageLinks, $languageLinks) or die(mysql_error());


while ($row = mysql_fetch_array($languageLinks)){
		
		echo '<br/><b>Job:</b> '.$row['Job'];
			echo '<br/><b>Job Date:</b> '.$row['JobDate'];
	echo '&nbsp;&nbsp;&nbsp; <b>Start at:</b> '.$row['Start'];
		echo '<br/><b>Rescheduled on:</b> ' .$row['2JobDate'];
		echo ' <br/><b>Language:</b> '.$row['Lang'];
	echo '<br/><b>Interpreter:</b> '.$row['FirstName'];
	echo '&nbsp;'.$row['Surname'];
	echo '<br> <b>Agency/Org:</b> '.$row['ClientName'];
			echo '<br> <b>Location:</b> '.$row['JobAdd'];
		echo '<br> <b>For Non English Speaker:</b> ' .$row['NESB'];

	echo '<br> <b>Ref:</b> '.$row['URN'];

	echo '<br> <b>Interpreter Short Notice:</b> '.$row['ShNotCont'];
					echo '<br/> <b>Comment:</b> '.$row['Comment'];
	echo '<br/>';
	echo '<br/>';
	echo '<br/>';
	 echo '<a href="mailto:'.$row['ContEmail'].'">'.$row['ContEmail'].'</a>'; 
	}

Open in new window

0
Comment
Question by:ChristianeGuise
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:CrAppl
ID: 35124849
You are opening your php tags but not closing it.

What exactly is not working?
0
 
LVL 1

Expert Comment

by:CrAppl
ID: 35124938
Ok, going through your question again, try this:
<h1>Please confirm the reception of this email and the acceptance of the job/s below:<br />Information for</h1> 	 
      <?php
$term = $_POST['term'];
$term1 = $_POST['term1'];

$body="";

mysql_select_db($database_languageLinks, $languageLinks);
$query_languageLinks = "SELECT * FROM jobs WHERE Job LIKE '%$term%' AND Let LIKE '%$term1%'";
$languageLinks = mysql_query($query_languageLinks, $languageLinks) or die(mysql_error());


while ($row = mysql_fetch_array($languageLinks)){
		$body .= " ".$row['Job'];

		echo '<br/><b>Job:</b> '.$row['Job'];
			echo '<br/><b>Job Date:</b> '.$row['JobDate'];

			$body .= " ".$row['JobDate'];

	echo '&nbsp;&nbsp;&nbsp; <b>Start at:</b> '.$row['Start'];

	$body .= " ".$row['Start'];

		echo '<br/><b>Rescheduled on:</b> ' .$row['2JobDate'];

	$body .= " ".$row['2JobDate'];

		echo ' <br/><b>Language:</b> '.$row['Lang'];
	echo '<br/><b>Interpreter:</b> '.$row['FirstName'];
	echo '&nbsp;'.$row['Surname'];
	echo '<br> <b>Agency/Org:</b> '.$row['ClientName'];
			echo '<br> <b>Location:</b> '.$row['JobAdd'];
		echo '<br> <b>For Non English Speaker:</b> ' .$row['NESB'];

	echo '<br> <b>Ref:</b> '.$row['URN'];

	echo '<br> <b>Interpreter Short Notice:</b> '.$row['ShNotCont'];
					echo '<br/> <b>Comment:</b> '.$row['Comment'];
	echo '<br/>';
	echo '<br/>';
	echo '<br/>';
	 echo '<a href="mailto:'.$row['ContEmail'].'?body=$body">'.$row['ContEmail'].'</a>'; 
	}

Open in new window

0
 

Author Comment

by:ChristianeGuise
ID: 35125457
This works as the recipient receives the email but there is nothing in it
except
$body
Anymore idea?
 thank you so so much for helping me
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:CrAppl
ID: 35125477
Oops, I missed the single quotes...
I don't test the code as I reply quick :)

You're welcome, the solution below should help you but I still think you are doing this strangely.

Change this line:
 echo '<a href="mailto:'.$row['ContEmail'].'?body=$body">'.$row['ContEmail'].'</a>';

to this:
 echo "<a href=\"mailto:".$row['ContEmail']."?body=$body\">".$row['ContEmail'].'</a>';


 
0
 

Author Comment

by:ChristianeGuise
ID: 35125499
Thank you so much you are a GENIUS
yes it is probably a little strange but I only start with datadase and know so little
if you have a better idea and I am sure you do please let me know
Meanwhile thank you so so much
0
 
LVL 1

Accepted Solution

by:
CrAppl earned 2000 total points
ID: 35125541
You're welcome :)

Look into mail()
php.net/mail

you should be able to mail someone automatically instead of using mailto:

If you have problems, create a new question and message me here

Dont forget to award the points before starting the new thread!
0
 

Author Closing Comment

by:ChristianeGuise
ID: 35125663
Yes it was great
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question