<?php
$connection = mysql_connect("localhost","root","1234") or die("เชื่อมต่อฐานข้อมูลไม่ได้");
$db = mysql_select_db("workpermit" , $connection ) or die ("ติดต่อฐานไม่ได้");
mysql_query("SET NAMES UTF8");
$sql = "SELECT SUM (CASE WHEN permit_sex = 'ชาย' THEN 1 ELSE 0 END ) AS MALE,
SUM( CASE WHEN permit_sex = 'หญิง'THEN 1 ELSE 0 END ) AS FEMALE
FROM workpermit
WHERE d_receive
BETWEEN '2552-08-25'AND '2552-09-19' ";
$sql_result = mysql_query($sql,$connection) or die ("เอ็กซิคิวต์คำสั่งไม่ได้ ");
$rsCount_2 = mysql_result($sql_result,0);
echo ?ใช้คำสั่งอะไรครับ?
?>