SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    send email via there user_id

    Hi guys Im trying to send a email based on there user_id which im calling via the session

    but the email isnt being sent. Can anyone help me?

    PHP Code:
        $sql2 = ("select * from   jobseekers where user_id = '". $_SESSION['seeker'] ."'"); 
       
      
                  $result = mysql_query ($sql2);

                  while ($row = mysql_fetch_array($result))
                  {
                  
                  
                  
    $field12= $row["user_email"];          
                  
                  
                  
    $to      = $_POST['<? echo $field12?>'];


    $subject = 'Your CV has been added';

    $message = 'Thank you  for joining . You can now log in to your account';

    $headers = 'From: crimball316@aol.com';



    mail($to, $subject, $message, $headers);


    }

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    PHP Code:
    $to $field12 
    or
    PHP Code:
    $to $row["user_email"]; 
    also you dont need it in a while loop as you are only expecting one result - the user.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I deleted the loop and change the $to code but it still didnt work

    heres the changed script

    PHP Code:
    // send email


        
    $sql2 = ("select * from   jobseekers where user_id = '"$_SESSION['seeker'] ."'"); 
       
      
                  
    $result mysql_query ($sql2);

             
                  {
                  
                                  
                                  
    $to $row["user_email"]; 



    $subject 'Your CV has been added';

    $message 'Thank you  for joining notexperienced.co.uk. You can now log in to your account';

    $headers 'From: support@notexperienced.co.uk';



    mail($to$subject$message$headers);




  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    you deleted the loop AND the results hander mysql_fetch_assoc() !
    PHP Code:
    $sql2 = ("select * from   jobseekers where user_id = '"$_SESSION['seeker'] ."'"); 
    $result mysql_query ($sql2); 
    $row mysql_fetch_assoc($sql2);
            
    $to $row["user_email"]; 

    $subject 'Your CV has been added'

    $message 'Thank you  for joining notexperienced.co.uk. You can now log in to your account'

    $headers 'From: support@notexperienced.co.uk'


    mail($to$subject$message$headers); 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    many thanks my mistake

    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/notexper/public_html/insertcv.php on line 40
    it says this line is wrong

    $sql = ("select * from jobseekers where user_id = '". $_SESSION['seeker'] ."'");

    but I use it on many pages and cant seem to understand what could be wrong with it

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    change your query line to:
    PHP Code:
    $result mysql_query ($sql2)or die(mysql_error() .'SQL = ' .$sql2); 
    See what it says

    Edit:


    is it $sql or $sql2.....
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •