$query_check_domain_exists = "SELECT * FROM schools where domain ='$email_domain'";
$result_check_domain_exists = mysqli_query($d_schools, $query_check_domain_exists);
$school_ID_result = ?
$school_ID_result 变量需要包含它刚刚查找的行的 school_ID(主键)(只有一个)。
最佳答案
添加mysqli_fetch_assoc()然后从数组中获取 school_ID
:
$query_check_domain_exists = "SELECT * FROM schools where domain ='$email_domain'";
$result_check_domain_exists = mysqli_query($d_schools, $query_check_domain_exists);
$row = mysqli_fetch_assoc($result);
$school_ID_result = $row['school_ID'];
关于php - 如何获取以前查找过的一行的MySQL主键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12127198/