HI all very newbe question here I have a small mysql database and wish to send a email to a person every time they fill out my contact page aslo adding a 3 rows from the DB I have managed to send the email with success and also connected to the database but having problems outputting MSQL select query in the message body within loop. how would I add this within the text body of the email (as you can see the coding is a bit wrong) would it better to define the $row as a variable first as I tried that but still could not get the correct syntax for the while statement i guess i dont use echo as that put it to the screen $message4= " blab blab “ . while ($row = mysql_fetch_array($result)) { $row['Company'] . “<br> “ . $row['description'] .â€â€; } I am really puzzled
That is some clever PHP there. $message4= " blab blab <br>“; while ($row = mysql_fetch_[b]assoc[/b]($result)) { $message4 .= $row['Company'] . “<br> “ . $message4 .= $row['description'] . "<br>"; } Code (markup): Also the hash is case sensitive. "Company" needs to have an upper case C in the table structure as well.
Ok lets trying again I have a database with the fileds company , name , url I have a conact us page in PHP which when a person clicks it will call the php file to send a email the file should select the company , name , url from the database and insert it in to the a email to reply back to the person. Problem.. I do not know how to insert the result from the select statement into the email as i cannot get the correct syntax eg the person would see a email Have a nice day <company> <name> <url> (Row 1) <company> <name> <url> (Row 2) <company> <name> <url> (Row 3)
What I posted will work as long as the hash is using the right table field names. You then just need to figure out what HTML to put into the string along with the row values.
Ok !!! MAGIC before i say where do i send the money , its repating the whole 2 3 time any ideas why for each row , it should repate the fileds right
Try this: $message4= " blab blab <br>"; while ($row = mysql_fetch_assoc($result)) { $message4 .= $row['Company'] . "<br /> " .$row['description'] . "<br>"; } PHP: Brew
YOU ARE DA MAN!!!! I AM SO HAPPY IF YOU COULD SEE ME NOW !!!! Back spinning like the GICO green thing...