如何在一个插入查询中插入来自查询结果和其他变量的数据?
样本:
$id = $_POST['id'];
$address = $_POST['address'];
$email = $_POST['email'];
$query = "INSERT INTO info_table(fname, lname, address, email) VALUES (SELECT fname, lname, FROM info WHERE id = '$id')";
$result = db->prepare($query);
$result->execute();
我如何插入$address
并$email
与选择结果变量一起?