2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by diafol
0

Hello guys,

after some searching and playing around and ofcourse with alot of help. i have got this code, which basically GETs ID from browser and then sends them an email, but why isnt it working, can some one please show me why.
thank you

<?php 
    $con = mysql_connect("localhost", "t", "4545"); 
    if (!$con) 
        { 
            die('could not connect: ' . mysql_error()); 
        } 
    mysql_select_db("t",$con); 
        if(isset($_GET['ID'])){ 
                $result = mysql_query("SELECT EMail from t_table WHERE ID = '".$_GET['ID']."' LIMIT 1"); 
                } 
                [B]$row = mysql_fetch_array($result);                 
                    $to = $row['EMail'];[/B] 
                    $subject = "My subject"; 
                    $message = "Hello world!"; 
                    mail($to,$subject,$message); 
    mysql_close($con); 
?>

Thank you for your assistance

Try that. However, getting info straight from the querystring and not validating/cleaning before use in a DB call is a little dangerous.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.