如何select来自2个表的信息?

How to select information from 2 tables?

我正在尝试从两个表中获取数据:

$con = getDbConnect();
$edit = $_GET['edit'];

if (mysqli_connect_errno($con)) {
    "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
    $result = mysqli_query($con, "SELECT * FROM admininfo where email='" . $edit . "'");
    $results = mysqli_query($con, "SELECT * FROM adminaccount where email='" . $edit . "'");

while ($admininfo = mysqli_fetch_array($result, $results)) {

无论您从多少表中选择,您都使用单个查询,例如

SELECT a.*, b.* FROM table1 a, table2 b where a.id = ? AND b.id = ?

然后你从结果中获取你需要的东西,看看docs

-- 当然,不要使用 select *.