33 lines
911 B
PHP
33 lines
911 B
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
error_reporting(E_ERROR | E_PARSE);
|
||
|
$Id = $_REQUEST['id'];
|
||
|
if($cond_column_name!=''){
|
||
|
$cond_column_name_array=explode(",",$cond_column_name);
|
||
|
}
|
||
|
if($cond_column_value!=''){
|
||
|
$cond_column_value_array=explode(",",$cond_column_value);
|
||
|
}
|
||
|
$end_query="";
|
||
|
for($j=0;$j<count($cond_column_value_array);$j++){
|
||
|
if($j==0)
|
||
|
$end_query.="$cond_column_name_array[$j]='$cond_column_value_array[$j]'";
|
||
|
//echo $cond_column_name_array[$j];
|
||
|
else
|
||
|
$end_query.="and $cond_column_name_array[$j]='$cond_column_value_array[$j]'";
|
||
|
//echo $cond_column_name_array[$j];
|
||
|
|
||
|
}
|
||
|
//echo $end_query;
|
||
|
$query="select $field1,$field2 from $table_name where ".$end_query;
|
||
|
//echo $query;
|
||
|
$results=mysqli_query($conn,$query);
|
||
|
$data=array();
|
||
|
$i=0;
|
||
|
while($rows=mysqli_fetch_array($results)){
|
||
|
$data[$i]['key']=$rows[$field1];
|
||
|
$data[$i]['value']=$rows[$field2];
|
||
|
$i++;
|
||
|
}
|
||
|
echo json_encode($data);
|
||
|
?>
|