if($index){ while($index1 = mysqli_fetch_array($index)){ echo "Existe"; }}else{ echo'error... no hay datos';}