Jump to content

request 2 id from dBase


web_master

Recommended Posts

Did you try my code? What didn't work about it?

 

You have this line just by itself:

WHERE `id` = '1546' AND `id` = '1'

 

You have to put that in an actual query. That is only part of a query, look at the example I gave you above.

well, script is complecsly mailer:

 

<?php
include "../mysql_connect.php";
error_reporting(E_ERROR);
@ini_set('display_errors', '1');




include ('nxs_mimemail.inc.php');

if($_POST['email_sendto'] == "0") { $where = "WHERE `id` = '1546' AND `id` = '1' AND `email_id` = '".$_POST['email_id']."' ";}
if($_POST['email_sendto'] == "1") { $where = "WHERE `ugyfel_korlevel` = '1' ORDER BY `id` ASC" ;}

// Reload from dBase
$query_return = mysql_query("SELECT
	`email`.`email_id`,
	`email`.`email_txt`,
	`email`.`email_sendto`,
	`ugyfelek`.`id`,
	`ugyfelek`.`e_mail`,
	`ugyfelek`.`ugyfelnev`,
	`ugyfelek`.`ugyfel_korlevel`
FROM
	`email`,`ugyfelek`
".$where."
");

if(!$query_return) {
	print mysql_error();
	exit;
}


while($request = mysql_fetch_array($query_return)) {



// Reload photo
$email_photo = $request['email_id']."_email_photo.jpg";
	if(is_file($email_photo)){
		$photo_view = "<img src=\"".$email_photo."\" alt=\"\" />";
	} else {
		$photo_view = "—";
	}


// MAIL
$from	= "[email protected]";
$to		= $request['e_mail'];




// Embedded pictures
$image2 = "mailer_headline.jpg";
$image3 = "headline_fruits.jpg";
$image	= $email_photo;


$subject = "Hiros foliahaz kft. :: Megoldasok foliahazakhoz";
$text = $request['email_txt'];






$html ="

<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Hírös Fóliaház Kft. • körlevél</title>
<style type=\"text/css\">
<!--
body {
background: #ffdead;
}

.maintable {
width: 500px;
}

.headlinetable {
height: 64px;
}

.headlinescroll {
height: 10px;
border: solid;
border-width: 0px 1px 0px 1px;
border-color: #d6d8d9;
}

.maintd {
border: solid;
border-width: 0px 1px 1px 1px;
border-color: #d6d8d9;
vertical-align: top;
padding: 10px;
}

.footertd {
border: solid;
border-width: 0px 1px 1px 1px;
border-color: #d6d8d9;
padding: 10px;
}

.footertxt {
font-family: Georgia, \"Times New Roman\", serif;
font-size: 10px;
font-weight: bold;
color: #bcb9b8;
text-align: center;
margin: 0px;
}

.bodytext {
font-family: Georgia, \"Times New Roman\", serif;
font-size: 14px;
font-weight: normal;
color: black;
text-align: left;
line-height: normal;
margin: 0px;
}

.nomail {
font-family: Georgia, \"Times New Roman\", serif;
font-size: 8px;
font-weight: bold;
color: green;
text-align: center;
margin: 0px;
}

-->
</style>
</head>

<body>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"maintable\">
<tr>
	<td class=\"headlinetable\"><img src=\"mailer_headline.jpg\" alt=\"\" /></td>
</tr>

<tr>
	<td class=\"headlinescroll\"><img src=\"headline_fruits.jpg\" alt=\"\" /></td>
</tr>

<tr>
	<td class=\"maintd\">
	<p class=\"bodytext\">".nl2br($request['email_txt'])."</p>
	<p class=\"bodytext\"> </p>
		".$photo_view."
	</td>
</tr>

<tr>
	<td class=\"footertd\">
		<p class=\"footertxt\">
			Hírös Fóliaház Kft.<br />
			H 6000 Kecskemét<br />
			Heliport Technik-Park<br />
			Mobil: +36 30/550-9870<br />
			email: [email protected]<br />
			url: http://www.foliahaz.hu</p>

		<p class=\"nomail\">Leiratkozás a hírlevélről</p></td>
</tr>
</table>

</body>
</html>
";
$mimemail = new nxs_mimemail();
$mimemail->new_mail($from, $to, $subject, $text, $html);

$mimemail->add_attachment($image2, "mailer_headline.jpg");
$mimemail->add_attachment($image3, "headline_fruits.jpg");
$mimemail->add_attachment($image, $email_photo);

// Sent mail
if ($mimemail->send())
	print $request['id'].".  ".$request['ugyfelnev']."  ( ".$request['e_mail']." )<br />";
else
	print "ERROR nincs elküldve a mail!<br />";

} // end of while
?>

Ummm. id won't be both 1 AND 1546 at the same time in any row. To retrieve the rows with id's = 1, 1546, you need to use the OR operator or use the IN() function. Assuming that id is a numeric data type -

 

WHERE id = 1 OR id = 1546

 

WHERE id IN(1,1546)

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.