显示基于id_number的值

时间:2017-10-10 18:31:06

标签: php mysql database reference

我在数据库中有2个表

reffQuestion               

ID  QUESTION                  
1   Your pet                  
2   Your fav food              
3   Your hobbies
4   Your fav color
reffAnswer

IDS ANSWER
1   Cat
2   Pizza
3   Sport
4   Blue

如果我写row["1"];,则可以显示ANSWER

的值

我写道:

$SQL = "SELECT A.ID from reffQuestion A
        INNER JOIN reffAnswer B on B.IDS = A.ID"

$res = mysql_query($SQL);
while ($row = mysql_fetch_assoc($res)){
        $i++;
        $answer[$i] =  $row['answer'];
}

0 个答案:

没有答案