<?php
include "config.php";
$tblJ="KEIQI117_data1.sys_RespNum=KEIQI117_data2.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data3.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data4.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data5.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data6.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data7.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data8.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data9.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data10.sys_RespNum and KEIQI117_data1.sys_RespNum=KEIQI117_data11.sys_RespNum";
$tblX="KEIQI117_data1,KEIQI117_data2,KEIQI117_data3,KEIQI117_data4,KEIQI117_data5,KEIQI117_data6,KEIQI117_data7,KEIQI117_data8,KEIQI117_data9,KEIQI117_data10,KEIQI117_data11";
$q = mysqli_query($conn,"SELECT COUNT(`Q21_r4_c1`) FROM $tblX WHERE $tblJ AND sys_RespStatus = 5 AND `Q21_r4_c1` IN (1,2,3,4,5,6)");

echo "SELECT COUNT(`Q21_r4_c1`) FROM $tblX WHERE $tblJ AND sys_RespStatus = 5 AND `Q21_r4_c1` IN (1,2,3,4,5,6)";

echo "</br>";

$baseX=mysqli_fetch_array($q);   
$base = $baseX[0];
echo $base;

?>