Mailinglisten-Archive |
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01C15428.C9D3A3C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Hi Cracks,
ich möchte folgendes machen:
Aus einer MySQL Datenbank sollen der Text und der Betreff für eine e-Mail
ausgelesen werden.
Beides soll Variablen beinhalten können, die zur Laufzeit erst gefüllt
werden sollen.
Hier mal ein paar Code-Ausschnitte:
NOTX_TEXT beinhaltet den Text: Hallo $name, Dies ist ein Test.
NOTX_BETREFF beinhaltet den Text: an $name
<?php
$name = "Jürgen";
$empfaenger = empfaenger_(at)_domain.de;
$absender = webmaster_(at)_domain.de;
$reply = info_(at)_domain.de;
//Auslesen der Tabelle SNO_TEXTE in dieser Datenbank
$query = "select NOTX_ID
,NOTX_BESCHREIBUNG
,NOTX_TEXT
,NOTX_BETREFF
from SNO_TEXTE
where NOTX_KZ = 'TEST'";
$res = mysql_query($query, $link);
if (!$res)
die("Anfrage $query scheitert.<br>\n");
// Bestimme Größe des Ergebnisses
$rows = mysql_num_rows($res);
$cols = mysql_num_fields($res);
// Durchlesen des Ergebnisses
$num = mysql_numrows($res);
$row = mysql_fetch_array($res);
$text = stripslashes($row[NOTX_TEXT]);
$betreff = stripslashes($row[NOTX_BETREFF]);
if ($num == 0) echo "Keine Übereinstimmung gefunden!";
mail("$empfaenger", "$betreff", $text, "From: $absender\nContent-Type:
text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit\nReply-To:
$reply\nX-Mailer: PHP/" . phpversion());
$betreff = nl2br(htmlentities($betreff));
$text = nl2br(htmlentities($text));
echo "$betreff<br><br>";
echo "$text";
?>
Nun wird aber in der e-Mail folgendes übermittelt:
Betreff: an $name
Text: Hallo $name, Dies ist ein Test.
Was kann ich denn machen, damit die Variablen gefüllt werden und statt $name
der Text Jürgen übermittelt wird?
Schon mal vielen Dank für Euere Hilfe.
Jürgen
------=_NextPart_000_0000_01C15428.C9D3A3C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Hi=20
Cracks,</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>ich =
m=F6chte folgendes=20
machen:</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Aus =
einer MySQL=20
Datenbank sollen der Text und der Betreff f=FCr eine e-Mail ausgelesen=20
werden.</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Beides =
soll=20
Variablen beinhalten k=F6nnen, die zur Laufzeit erst gef=FCllt werden=20
sollen.</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Hier =
mal ein paar=20
Code-Ausschnitte:</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial =
size=3D2>NOTX_TEXT beinhaltet=20
den Text: Hallo $name, Dies ist ein Test.</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial =
size=3D2>NOTX_BETREFF=20
beinhaltet den Text: an $name<BR></DIV></FONT></SPAN>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3D"Courier New"=20
size=3D2><?php<BR>$name =3D "J=FCrgen";</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT size=3D2><FONT=20
face=3D"Courier New">$empfaenger =3D </FONT><A=20
href=3D"mailto:empfaenger_(at)_domain.de"><FONT=20
face=3D"Courier New">empfaenger_(at)_domain.de</FONT></A><FONT=20
face=3D"Courier New">;<BR>$absender =3D </FONT><A=20
href=3D"mailto:webmaster_(at)_domain.de"><FONT=20
face=3D"Courier New">webmaster_(at)_domain.de</FONT></A><FONT=20
face=3D"Courier New">;<BR>$reply =3D </FONT><A =
href=3D"mailto:info_(at)_domain.de"><FONT=20
face=3D"Courier New">info_(at)_domain.de</FONT></A><FONT=20
face=3D"Courier New">;<BR></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3D"Courier New"=20
size=3D2> //Auslesen der Tabelle SNO_TEXTE in dieser=20
Datenbank<BR> $query =3D "select =20
NOTX_ID<BR> &n=
bsp; =20
,NOTX_BESCHREIBUNG<BR> &nb=
sp; &nbs=
p;=20
,NOTX_TEXT<BR>  =
; =20
,NOTX_BETREFF<BR> &n=
bsp; =20
from =20
SNO_TEXTE<BR> =
=20
where NOTX_KZ =3D=20
'TEST'";<BR> &=
nbsp; =20
<BR> $res =3D mysql_query($query, =
$link);<BR> =20
if (!$res)<BR> die("Anfrage $query=20
scheitert.<br>\n"); </FONT></SPAN></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3D"Courier New"=20
size=3D2> // Bestimme Gr=F6=DFe des=20
Ergebnisses<BR> $rows =3D=20
mysql_num_rows($res);<BR> $cols =3D=20
mysql_num_fields($res);</FONT></SPAN></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3D"Courier New"=20
size=3D2> // Durchlesen des =
Ergebnisses<BR> =20
$num =3D mysql_numrows($res);</FONT></SPAN></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3D"Courier New"=20
size=3D2> $row =3D=20
mysql_fetch_array($res);<BR> <BR>  =
; $text=20
=3D stripslashes($row[NOTX_TEXT]);<BR> $betreff =3D=20
stripslashes($row[NOTX_BETREFF]);<BR> =
=20
<BR> if ($num =3D=3D 0) echo "Keine =DCbereinstimmung=20
gefunden!";</FONT></SPAN></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3D"Courier New"=20
size=3D2>mail("$empfaenger", "$betreff", $text, "From: =
$absender\nContent-Type:=20
text/plain; charset=3Diso-8859-1\nContent-Transfer-Encoding: =
8bit\nReply-To:=20
$reply\nX-Mailer: PHP/" . phpversion());<BR> =20
<BR> $betreff =3D=20
nl2br(htmlentities($betreff));<BR> $text =3D=20
nl2br(htmlentities($text));<BR> echo=20
"$betreff<br><br>";<BR> echo=20
"$text";<BR>?></FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Nun =
wird aber in der=20
e-Mail folgendes =FCbermittelt:</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial =
size=3D2>Betreff: an=20
$name</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Text: =
Hallo $name,=20
Dies ist ein Test.</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Was =
kann ich denn=20
machen, damit die Variablen gef=FCllt werden</FONT> <FONT =
face=3DArial=20
size=3D2>und statt $name der Text J=FCrgen =FCbermittelt =
wird?</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial size=3D2>Schon =
mal vielen=20
Dank f=FCr Euere Hilfe.</FONT></SPAN></DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D500412218-13102001><FONT face=3DArial=20
size=3D2>J=FCrgen</FONT></SPAN></DIV></BODY></HTML>
------=_NextPart_000_0000_01C15428.C9D3A3C0--
php::bar PHP Wiki - Listenarchive