$level = $_POST['level'];
$group = $_POST['group'];
// Check database is already
$sql = "select * from member where level == 'M001' and group = '$group' ";
$result = mysql_query($sql) or exit($sql);
$row = mysql_fetch_array($result);
if (!empty($row[level])and($row[group]))
exit("<script>alert('Please change');history.back();</script>");
ถ้าเลือก level = M001 กับ group = ฺฺA หรือ B หรือ C ก็จะแสดง Please change
หรือถ้าเลือก level = U001 กับ group = ฺฺA หรือ B หรือ C ก็จะแสดง Please change
Code (PHP)
$sql = "select * from member where level = 'M001' and group = '$group' ";
$result = mysql_query($sql) or exit($sql);
$row = mysql_fetch_array($result);
if (!empty($row[level])and($row[group]))
exit("<script>alert('Please change');history.back();</script>");