Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    emailing chunk of HTML from mySQL database

    I'm trying to read a chunk of HTML from a record in a mySQL database and email it using PHP's mail function.

    My code is a bit on the complex side (which is why i've not posted it) but it reads from the database fine and when it goes to email the data (using PHP's mail() command) it responds with error:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/sites/site165/web/fstudent/html/newsm2f.php on line 55

    I imagine I would need to parse the SQL entry first.

    Any ideas on how to do this? :-)
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ... actually the code isn't that bad (i've slimmed it down a bit)...

    PHP Code:
    $query "SELECT * FROM fs_news WHERE id='".$id."'";

        if (
    $mysql_result mysql_query($query$linkdb)) {
            if (
    ExecuteQuery($linkdb$result$query)) {
                while (
    $row NextRow($result)) {
    $mess2 $row[3];
    $subject "News Article - ".$row[2];
    }
    }
    }

    $headers "From: $yname <$yemail>\n" .
            
    "To: $tname <$temail>\n" .
            
    "Bcc: Admin <brian@sweenster.co.uk>\n";
    $message =     "This article was emailed to you from sweenster.co.uk by ".$yname." (".$yemail.").\n\n".$yname." says:\n".$msg."\n\n_____________________________________________________________";
    $message .=     "".$mess2.n_____________________________________________________________" .
              "
    nhttp://www.sweenster.co.uk";

    $ok = @mail($tmail$subject$message$headers);
    if (
    $ok) {
        
    #print confirmation
        
    print('<p class="bl"><strong>E-mail Sent Successfully!</strong></p>');
        print(
    '<a href="_index.php?page=news&cat='.$id.'&mlst=0&data='.$usmdata.'">Click to return to gallery</a>');
    } else {
        print(
    '<script type="text/javascript">alert(\'An Error has occurred. Please Check and Try Again.\');');
        print(
    'history.back();</script>');

    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •