Solved

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

Posted on 2011-03-13
7
283 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
Industry Leaders: 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 500 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 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