Guest User

Untitled

a guest
Oct 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. function selectfuncionarios($tabela,$colunas='*',$where=1){
  2. include 'conect.php';
  3. $sql ="SELECT $colunas FROM $tabela WHERE $where";
  4. $executar= mysqli_query($con,$sql);
  5. $colunasdivididas = explode(",", $colunas);
  6. $numerodecolunas = count($colunasdivididas);
  7. $ii=0;
  8. $numero=['numeroderetorno'=>2];
  9. while($row = mysqli_fetch_array($executar)){
  10. if($colunas!='*' AND $numerodecolunas>0 ){
  11.  
  12.  
  13. for($l=0;$l<$numerodecolunas;$l++){
  14. $array[$ii] =array($ii=>$row[$colunasdivididas[$l]]);
  15.  
  16. $ii++;
  17. }
  18.  
  19. }elseif($colunas=='*'){
  20.  
  21. }else{
  22. $array =array($colunasdivididas[$l]=>$row[$colunasdivididas[$l]]);
  23.  
  24. }
  25.  
  26.  
  27. }
  28.  
  29.  
  30. return json_encode($array);
  31. }
  32.  
  33. while($row = mysqli_fetch_array($result)) {
  34. $posts['post_id'] = $row['post_id'];
  35. $posts['post_title'] = $row['post_title'];
  36. $posts['type'] = $row['type'];
  37. $posts['author'] = $row['author'];
  38. }
Add Comment
Please, Sign In to add comment