📜  如何从按钮将会话数据添加到 mysql 数据库 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:29.600000             🧑  作者: Mango

代码示例1
$conn = Connect(); //your MySQLDB connection

// extract values from session to variables
$username= $conn->real_escape_string($_SESSION['auth_user']['username']);
$email= $conn->real_escape_string($_SESSION['auth_user']['email']);
$phone= $conn->real_escape_string($_SESSION['auth_user']['phone']);

//query execution
$query = $conn->prepare("INSERT into loginDetails(username,email,phone) VALUES (?, ?, ?)");
$query->bind_param("sss", $username, $email, $phone); 
$query->execute();