I have two tables in my databases with the following structures
1.ps_branch
COLUMNS: ps_code a1 a2 a3 a4 a5 a6 a7
2.students_info
COLUMNS: std_name std_cg st_code
I am using xampp server.
I wrote a query in php:
$qs1="select * from station_details where st_code IN
(
( select DISTINCT st_code FROM students_info , ps_branch WHERE ps_code=st_code AND std_cg >".$_POST['Cgpa'].
"AND".$_POST['branch']."=".'1'."))";
$query1=mysqli_query($con1,$qs1);
But the query is showing me error. When i query the following directly in phpmyadmin mysql i get the answer i required
select * from station_details where st_code IN
(
( select DISTINCT st_code FROM students_info , ps_branch WHERE ps_code=st_code AND std_cg>6
AND a7=1)
)
$_POST['branch'] will give one of the values a1 a2 ...or a7 $_POST['Cgpa'] is a numerical value