Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function selectfuncionarios($tabela,$colunas='*',$where=1){
- include 'conect.php';
- $sql ="SELECT $colunas FROM $tabela WHERE $where";
- $executar= mysqli_query($con,$sql);
- $colunasdivididas = explode(",", $colunas);
- $numerodecolunas = count($colunasdivididas);
- $ii=0;
- $numero=['numeroderetorno'=>2];
- while($row = mysqli_fetch_array($executar)){
- if($colunas!='*' AND $numerodecolunas>0 ){
- for($l=0;$l<$numerodecolunas;$l++){
- $array[$ii] =array($ii=>$row[$colunasdivididas[$l]]);
- $ii++;
- }
- }elseif($colunas=='*'){
- }else{
- $array =array($colunasdivididas[$l]=>$row[$colunasdivididas[$l]]);
- }
- }
- return json_encode($array);
- }
- while($row = mysqli_fetch_array($result)) {
- $posts['post_id'] = $row['post_id'];
- $posts['post_title'] = $row['post_title'];
- $posts['type'] = $row['type'];
- $posts['author'] = $row['author'];
- }
Add Comment
Please, Sign In to add comment