我正在尝试获取外键对象ID,但它无效。
$sql2 = "SELECT a.*, q.* FROM answer a inner join question q on a.question_id = q.id WHERE a.question_id = 1";
$result2 = $conn ->query($sql2);
while($row2 = $result2->fetch_assoc()) {
echo "<input name='group1' type='radio' id='". $row2['id'] ."' />" . "<label for='". $row2['id'] ."'>".$row2['answer_text']."</label>";
}
答案 0 :(得分:1)
$result2 = $conn ->query($sql2);
$conn
无空间地尝试:
$result2 = $conn->query($sql2);