Solved

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

Posted on 2011-03-13
7
285 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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.
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

635 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