PHP Tutorials
- What is MySqli
- mysql query
- mysql query example
- InnoDB
- mysql column Type
- CRUD Example
- Connection Using Function
- mysql keys
- SELECT
- WHERE
- UPDATE
- Count no of Rows
- ALIAS
- AND, AND & OR
- BETWEEN
- COMPARISON OPERATOR
- DELETE
- DELETE LIMIT
- DISTINCT
- EXISTS
- FROM
- GROUP BY
- HAVING
- IN
- INTERSECT
- IS NULL & IS NOT NULL
- LIKE
- NOT
- ORDER BY
- SELECT LIMIT
- SUBQUERY
- TRUNCATE
- UNION && UNION ALL
- Concat & Group_Concat
- mysql Function
- Mysql Insert Id
- MySql Aggregate Function
- Mysql Join
- JOIN in MySql
- Trigger
- Procedure
- Transaction
- views
- Index
- SQL Injection
- Normalization
- Query Bind
- Interview Questions
Important Link
How to bind multiple Query into single Query.?
File name : index.php
$conn = mysqli_connect("localhost", "mytutorial", "funtoofun", "tutorialdb");
$sqlquery = "select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id NOT IN (select fki_id from menupermissions where fki_role !='".$role."')";
if($EmpNumber !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_emp_number ='231')";
}
if($EmpDesig !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_desig_id ='developer')";
}
if($EmpDepID !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_dep_id ='IT02')";
}
if($DepType !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_dep_type ='ittutorial')";
}
if($parent_id==0){
$sqlquery .= " order by sequence";
}
$result = mysqli_query($conn,$sqlquery);
$count = mysqli_num_rows($result);
if($count > 0) {
while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
{
}
}