I.Jokhadze I.Jokhadze - 3 years ago 120
PHP Question

Php can't get foreign key object id

i'm trying to get foreign key object id but it's not working.

$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>";

Answer Source
$result2 = $conn ->query($sql2);

There have no space after $conn

Try it without space:

$result2 = $conn->query($sql2);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download