SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Internal Server Error

    I have a script that uses the mail() function, but when it try to view the page online, it gives me an internal server error. If I take out the one mail function.. the script works fine.. but soon as I put it back in.. I get the error.

    here is the mail funtion line, and the surrounding few lines...

    PHP Code:
    while($row=mysql_fetch_array($result))
            {
                
                if (
    $row[phone]!="$phone")
                {
                    
    mail("$row[mail]","$subject","$content");
                }
            } 
    would the fact that im using sessions earlier in the script have anything to do with it?

  2. #2
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need double quotes around the variables in your mail() function call, but I doubt that is what is causing the problem. Does mail() work normally when you run it in a test script?

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It probably is the problem since

    PHP Code:
    mail("$row[mail]","$subject","$content"); 
    is gonna evaluate to "" and the mail server needs a to address. As Skunk said get rid of the quotes or if for some reason you must have them change

    PHP Code:
    mail("{$row['mail']}","$subject","$content"); 
    But reall change it to

    PHP Code:
    mail($row['mail'],$subject,$content); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I changed the code to what you posted, but it still is giving an internal server error

  5. #5
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    n/m
    I just copied freddys code... I forgot to change "$row[mail] to $row[email]

    its working now though.. thanx for the help


Bookmarks

Posting Permissions

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