I'm trying to create a function to do select
in the Database. But he is now bringing an array into the array. How to leave in an array only.
Code I created:
<?php
include 'conect.php';
function select($con,$tabela,$colunas,$where=1){
$sql ="SELECT $colunas FROM $tabela WHERE $where";
$executar= mysqli_query($con,$sql);
$colunasdivididas = explode(",", $colunas);
$numerodecolunas = count($colunasdivididas);
$numrow= mysqli_num_rows($executar);
$iii=1;
$numero=['numeroderetorno'=>2];
while($row = mysqli_fetch_array($executar)){
if($colunas!='*' AND $numerodecolunas>0 ){
for($l=0;$l<$numerodecolunas;$l++){
$array[$colunasdivididas[$l].'-'.$iii] = $row[$colunasdivididas[$l]];
}
}elseif($colunas=='*'){
}else{
$array[$colunasdivididas[$l].'-'.$iii] = $row[$colunasdivididas[$l]];
}
$iii++;
}
$arraynumrow=['reposta'=>$numrow];
$arrays=$arraynumrow+$array;
return $arrays;
}
$ts=selectfuncionarios($link,'dono','id,login,senha');
print_r($ts);
?>