$sql = 'SELECT m.id_m As id , m.name_m As name , m.idcard_m As idcard , m.address_m As address , m.rdate_m As rdate , '
. ' v.id_village As village , v.village As vill , '
. ' s.id_status As status , s.status As sta , '
. ' w.id_welfare As welfare , w.welfare As wel '
. ' FROM member m INNER JOIN village v ON m.id_village = v.id_village '
. ' INNER JOIN status s ON m.id_status = s.id_status '
. ' INNER JOIN welfare w ON m.id_welfare = w.id_welfare order by m.id_m asc LIMIT 0, 30 ';
$sql = 'SELECT m.id_m As id , m.name_m As name , m.idcard_m As idcard , m.address_m As address , m.rdate_m As rdate , '
. ' v.id_village As village , v.village As vill , '
. ' s.id_status As status , s.status As sta , '
. ' w.id_welfare As welfare , w.welfare As wel '
. ' FROM member m INNER JOIN village v ON m.id_village = v.id_village '
. ' INNER JOIN status s ON m.id_status = s.id_status '
. ' INNER JOIN welfare w ON m.id_welfare = w.id_welfare WHERE m.id = '.$_POST['m_id'].'order by m.id_m asc LIMIT 0, 30 ';
print("<td align='left'>
<a href=\"detail_mem.php?id_m=$id_m \" onclick=\"return confirm // ตัวแปร $id_m ที่ส่งไป ครับ
(' ต้องการดูข้อมูล $name_m หรือไม่\"> $name_m </a></td>");
///////////////////////////////////////
///////////////////////////////////////
อันนี้เป็นโค้ด หน้าที่รับค่าและนำไปดึงข้อมูลมา
$sql = 'SELECT m.id_m As id , m.name_m As name , m.idcard_m As idcard , m.address_m As address , m.rdate_m As rdate , '
. ' v.id_village As village , v.village As vill , '
. ' s.id_status As status , s.status As sta , '
. ' w.id_welfare As welfare , w.welfare As wel '
. ' FROM member m INNER JOIN village v ON m.id_village = v.id_village '
. ' INNER JOIN status s ON m.id_status = s.id_status '
. ' INNER JOIN welfare w ON m.id_welfare = w.id_welfare
WHERE m.id_m=$id_m' //ตัวแปร $id_m ตัวนี้ เมื่อ echo ดู จะมีค่า ตาม ที่ส่งมาครับ เป็นค่าที่ไม่ตายตัว
. ' asc LIMIT 0, 30 ';
$id_m = $_GET['id_m'];
$sql = 'SELECT m.id_m As id , m.name_m As name , m.idcard_m As idcard , m.address_m As address , m.rdate_m As rdate , '
. ' v.id_village As village , v.village As vill , '
. ' s.id_status As status , s.status As sta , '
. ' w.id_welfare As welfare , w.welfare As wel '
. ' FROM member m INNER JOIN village v ON m.id_village = v.id_village '
. ' INNER JOIN status s ON m.id_status = s.id_status '
. ' INNER JOIN welfare w ON m.id_welfare = w.id_welfare
WHERE m.id_m=$id_m'
. ' asc LIMIT 0, 30 ';
$sql = 'SELECT m.id_m AS id , m.name_m AS name , m.idcard_m AS idcard , m.address_m AS address , '
. ' m.rdate_m AS rdate , '
. ' v.id_village AS village , v.village AS vill , '
. ' s.id_status AS status , s.status AS sta , '
. ' w.id_welfare AS welfare , w.welfare AS wel '
. ' FROM member m , village v , status s , welfare w '
. ' WHERE m.id_welfare = w.id_welfare and m.id_village = v.id_village
and m.id_status = s.id_status and m.id_m =4 '// แทนค่าตัวแปรด้วยตัวเลข จาก $id_m
. ' ORDER BY m.id_m ASC LIMIT 0, 30 ';