<?php

  $conn = mysqli_connect('localhost','root','111111','math');

  $q_select_query = "SELECT q FROM a ";

  $q_result = mysqli_query($conn,$q_select_query);

  $q_row = mysqli_fetch_array($q_result);

  $a_select_query = "SELECT * FROM aa Where id=1";

  $a_result = mysqli_query($conn,$a_select_query);

  $a_row = mysqli_fetch_array($a_result);

  $test= str_replace($a_row[1],"( )",$q_row[0]);

?>


<script type="text/javascript" src="http://code.jquery.com/jquery-3.2.0.min.js" ></script>

<script type="text/javascript">

$(function(){

  $('.answer').hide();

  $('.test').click(function(){

    $('.test').hide();

    $('.answer').show();

  });

});

</script>


<div class='test'><?= $test ?></div></br>

<div class='answer'><?= $a_row[1]?></div></br>

<button class="answer" style="padding:3px" yes lt;/button>

<button class="answer" style="padding:3px" no</button>


이렇게 짰는데요 

잘되긴 하는데

a테이블하고 aa테이블하고  join으로 합쳐서 mysqli_query,  mysqli_fetch_array 문법을 한번만 쓰고 싶은데 방법을 잘 모르겠어요 


select*table a;

+--  +----------------------------------------------------------- +

| id  | q                                                                                          |

+-- +----------------------------------------------------------- +

|  7 | 주어진 조건에 의하여 그 대상을 분명하게 결정할 수 있는 모임을 집합이라고 한다.  |

|  8 | 집합을 이루는 대상 하나하나를 그 집합의 원소라고 한다                              |

+----+----------------------------------------------------------- +


select*table aa;

+---+----- +----- +----- +------+-----+--------+----+------+------+------+------+------+-----+

| id  | a0     | a1     | a2    | a3      | a4     | a5      | a6     | a7   | a8   | a9   | a10  | a11  | a12       | a_id |

+---+----- +----- +----- +----- +------+------+----  +------+------+------+------+------+---- +

|  1 | 조건   | 대상   | 분명   | 결정   | 모임    | 집합    | NULL | NULL | NULL | NULL | NULL | NULL | NULL |    7 |

|  2 | 집합   | 대상   | 원소   | NULL  | NULL   | NULL  | NULL | NULL | NULL | NULL | NULL | NULL | NULL |    8  |

+----+--------+--------+--------+--------+--------+--------+------+------+------+------+---+