Android中的多重查询

时间:2017-11-14 20:51:38

标签: php android

我希望每次客户点击注册页面上的提交按钮时填充记录,我不知道如何操作。这是代码;

<?php
    $con = //credentials
    $mobilenumber = $_POST['mobilenumber'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $pincode = $_POST['pincode'];
    $emailaddress = $_POST['emailaddress'];
    $birthday = $_POST['birthday'];

    $sql = mysqli_prepare($con, "INSERT INTO customer (firstname, lastname, mobilenumber, pincode, emailaddress, birthday) VALUES (?, ?, ?, ?, ?, ?) ");
    mysqli_stmt_bind_param($sql, "ssiiss", $firstname, $lastname, $mobilenumber, $pincode, $emailaddress, $birthday);
    mysqli_stmt_execute($sql);

    $response = array();
    $response["Success"] = true;
    json_encode($response);

    $sql2 = mysqli_prepare($dbconn, "SELECT custnum, mobilenumber, emailaddress FROM customer");
    while($data = mysqli_stmt_fecth($sql2)){
        $mobilenum = $data['mobilenumber'];
        $email = $data['emailaddress'];
        $custnum = $data['custnum'];
        $exp = date('Y-m-d', strtotime('+1 year'));
    }

    $sql3 = mysqli_prepare($con, "INSERT INTO accounts(userID, type, useraccounts, emailaddress, datecreated, accountexpiry, lastlogin) VALUES (?, ?, ?, ?, ?, ?, ?)");
    mysqli_stmt_bind_param($sql3, "ssssddd", $custnum,'Customer',$mobilenum, $email, curdate(), $exp, curdate() );
    mysqli_stmt_execute($sql3);
?>

0 个答案:

没有答案