来自数据库的PHP变量

时间:2017-08-08 18:07:44

标签: php mysql

我正在尝试从数据库结果中获取变量并使用此结果。我想用这个脚本发送一封电子邮件,我把它从网上下载了。我正在使用MySQL数据库。

这是一个注册脚本,所以我想在确认电子邮件后发送一封新邮件。使用TeamSpeak-Key。

ORDER BY

新变量必须进入:

$("#select").load("page.php?parameter1="$("#parameter").val());

<?php
require('includes/config.php');

//collect values from the url
$memberID = trim($_GET['x']);
$active = trim($_GET['y']);

$servername = "localhost";
$username = "xxx";
$password = "xxx";
$dbname = "xxx";

$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT email FROM members WHERE memberID='$memberID'";

if(is_numeric($memberID) && !empty($active)){
    $stmt = $db->prepare("UPDATE members SET active = 'Yes' WHERE memberID = :memberID AND active = :active");
    $stmt->execute(array(
        ':memberID' => $memberID,
        ':active' => $active,   
    ));

    if($stmt->rowCount() == 1){
        $to = $_POST[$e_mail];
        $subject = "Berechtigungsschlüssel";
        $body = "<p>Anbei findest du deinen Berechtigungsschlüssel</p>
            <p>function auslesen($line)</p>
            <p>Mit freundlichen Grüßen</p>
            <p>Betas.network</p>";

        $mail = new Mail();
        $mail->setFrom(SITEEMAIL);
        $mail->addAddress($e_mail);
        $mail->subject($subject);
        $mail->body($body);
        $mail->send();

        header('Location: login.php?action=active');
        exit;
    } else {
        echo "Your account could not be activated." ; 
    }
}
?>

0 个答案:

没有答案