Solved

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

Posted on 2011-03-13
7
282 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
  • 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 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