SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2002
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Getting mysql data in a e-mail

    hi, i got a mail script:


    <?php
    require ("signupconfig.php");

    if($action == "post"){

    $dbusername = "[username]";
    $dbpassword = "[pass]";
    $dbname = "[dbname]";
    $dbhost = "[dbhost]";
    $table_name = "signup";
    mysql_connect($dbhost, $dbusername, $dbpassword);
    mysql_select_db($dbname);

    $confirmkey = mysql_db_query($dbname,"SELECT * from $table_name ORDER BY body ASC") or die ("<p>Invalid query</p>");

    $emailerMessage .= "\n\n"; // 2 Line Breaks
    $emailerMessage .= $confirm; // URL to confirm.php -> see signupconfig.php
    $emailerMessage .= "?confirmkey=" . $confirmkey; // add confirm key to message
    $emailerMessage .= "\n"; // 2 Line Breaks
    $emailerMessage .= "your username: $username"; // 2 Line Breaks
    $emailerMessage .= "\n"; // 2 Line Breaks
    $emailerMessage .= "your password: $password"; // 2 Line Breaks
    $emailerMessage .= "\n\n"; // 2 Line Breaks

    $sent = @mail($email, $emailerSubject, $emailerMessage, "From:$emailerName<$emailerEmail>\nReply-to:$emailerEmail");
    echo "Your mail was sent";
    }
    ?>


    but when i run the scripts and i enter all the info and submit, the browser just loads very slow for sometime and than comes with 'can't find page' msg.
    i think it has to do something with connecting to the db, but im not sure

    please help me out

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks good to me. Why don't you remove that @ suppressant before mail(). That way if there's a problem there you can see it.

    Also, instead of doing all orange, use the [ php][ /php] tags (minus spaces). It fcolor codes everything as such:
    PHP Code:
    <?php
    require ("signupconfig.php");

    if(
    $action == "post"){

    $dbusername "[username]";
    $dbpassword "[pass]";
    $dbname "[dbname]";
    $dbhost "[dbhost]";
    $table_name "signup";
    mysql_connect($dbhost$dbusername$dbpassword);
    mysql_select_db($dbname);

    $confirmkey mysql_db_query($dbname,"SELECT * from $table_name ORDER BY body ASC") or die ("<p>Invalid query</p>");

    $emailerMessage .= "\n\n"// 2 Line Breaks
    $emailerMessage .= $confirm// URL to confirm.php -> see signupconfig.php
    $emailerMessage .= "?confirmkey=" $confirmkey// add confirm key to message
    $emailerMessage .= "\n"// 2 Line Breaks
    $emailerMessage .= "your username: $username"// 2 Line Breaks
    $emailerMessage .= "\n"// 2 Line Breaks
    $emailerMessage .= "your password: $password"// 2 Line Breaks
    $emailerMessage .= "\n\n"// 2 Line Breaks

    $sent = @mail($email$emailerSubject$emailerMessage"From:$emailerName<$emailerEmail>\nReply-to:$emailerEmail"); 
    echo 
    "Your mail was sent";
    }
    ?>
    Sketch
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Member
    Join Date
    Aug 2002
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    woohoo!i got it working

    mysql query wasn't total ok, replaced it with
    PHP Code:
      mysql_db_query($dbname,"SELECT * from signup"
    ty
    Last edited by yoda; Aug 29, 2002 at 07:48.


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
  •