There's also a potential problem with: "Her har du ditt passord: $myrow["id"] \n God appetitt! Hilsen Subway"
You are using double quotes for the array index,("id") within a double quoted string. I'm amazed php accepts this, you might expect it to parse that as "Her har du ditt passord: $myrow[" and then id and then "] \n God appetitt! Hilsen Subway" which should generate a syntax error at id. Until recently it certainly didn't substitute array variables in double quoted strings at all. There's a whole bunch of stuff in the manual now about ensuring correct parsing of variables inside double quotes with the use of braces etc. See: http://www.php.net/manual/en/language.types.string.php (N.B. I think the English version is more comprehensive than the German) However the simple safe thing to do is just to break the string i.e. "Her har du ditt passord: " . $myrow["id"] . " \n God appetitt! Hilsen Subway" Or even better IMHO: 'Her har du ditt passord: ' . $myrow['id'] . ' \n God appetitt! Hilsen Subway' Personally I don't think the automatic substitution of variables in double quotes really helps. I prefer to use single quotes since they don't get in the way of double quotes in HTML e.g. print '<TD COLSPAN="3">'; My simple rules are : single quotes for php strings double quotes in HTML/Javascript explicit concatenation of any php variables e.g. print '<TD COLSPAN="'.$myrow['colspan'].'">'; NOT print "<TD COLSPAN=\"{$myrow["colspan"]}\">"; Of course ,the important thing is to be consistent. Once you start inserting php array variables into Javascript strings inside HTML attributes of HTML embedded into php strings, you want to be sure you can work out what on earth is going on! Regards, George David Robley wrote: > > On Wed, 14 Nov 2001 04:26, Raymond wrote: > > Hi! > > > > I'm trying to send a mail with password to the new user of my website, > > but ......... Does anyone know how to put the variable inside my mail? > > > > I have tried this: > > > > ----------------------> > > else { > > > > // sende kundeopplysninger til databasen > > > > $db = mysql_connect("localhost", "root"); > > > > mysql_select_db("subway",$db); > > > > $sql = "INSERT INTO nettkunder > > (fornavn,etternavn,firma,adresse,postnr,sted,telefon,epost) VALUES > > ('$fornavn','$etternavn','$firma','$adresse','$postnr','$sted','$telefo > >n','$ epost')"; > > > > $result = mysql_query($sql); > > > > echo "Velkommen som kunde hos Subway.\n"; > > > > } > > > > $db = mysql_connect("localhost", "root"); > > > > mysql_select_db("subway",$db); > > > > > > $id = mysql_query("GET id FROM nettkunder WHERE epost = '$epost'",$db); > > > > mail("$epost", "Velkommen som kunde hos Subway", "Her har du ditt > > passord: $myrow["id"] \n God appetitt! Hilsen Subway"); > > The value you are passing in $myrow["id"] doesn't exist in your code. You > need to do > > $myrow = mysql_fetch_row($id); > > after your mysql_query to populate the row data. And your query should > probably read "SELECT id FROM... > > -- > David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc > CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA > > Washed the cat - took HOURS to get the hair off my tongue! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]