I'm working on a system and I'm having doubts about paging, I know I may have some grotesque mistakes because I do not "handle" much.
<?php include("cabecalho.php");
include("conexao.php");
include("banco-dados.php");
$totalReg = 11;
?>
<?php
//$pagina = (isset($_GET['pagina']))? $_GET['pagina'] : 1;
$pagina = $_GET['pagina'];
if (!$pagina) {
$pc = "1";
} else {
$pc = $pagina;
}
?>
<?php
$inicio = $pc -1
?>
<?php if(array_key_exists("removido", $_GET) && $_GET['removido'] == true) : ?>
<p class="alert-success">Chip apagado com sucesso</p>
<?php
endif
?>
<?php if(array_key_exists("add", $_GET) && $_GET['add'] == true) : ?>
<p class="alert-success">Chip adicionado com sucesso</p>
<?php
endif
?>
<?php if(array_key_exists("altera", $_GET) && $_GET['altera'] == true) : ?>
<p class="alert-success">Chip alterado com sucesso</p>
<?php
endif
?>
<table class="table2 table-striped table-bordered">
<form action="lista-chip.php" method="post">
<tr>
<td class="col-md-1"><input class="form-control" type="text" placeholder="Busca pelo o ddd" name="ddd"></td>
<td class="col-md-2"><input class="form-control" type="text" placeholder="Busca pelo o telefone" name="telefone"></td>
<td class="col-md-2"><input class="form-control" type="text" placeholder=" Busca pela a operadora" name="operadora"></td>
<td class="col-md-1"><input class="btn btn-default" type="submit"> </td>
</tr>
</form>
<tr>
<td><h5><strong>DDD</strong></h5></td>
<td><h5><strong>TELEFONE</strong></h5></td>
<td><h5><strong>OPERADORA</strong></h5>
<td><h5><strong>STATUS</strong></h5></td>
<td><h5><strong>FUNÇÕES</strong></h5>
</tr>
<?php
$inicio = $pc - 1;
$inicio = $inicio * $totalReg;
$chips = listaChips($conexao, $inicio, $totalReg);
foreach($chips as $chip) :
?>
<tr>
<td><?= $chip['DDD']; ?></td>
<td><?= $chip['TELEFONE']; ?></td>
<td><?= $chip['operadora_nome']; ?></td>
<td> <?= $chip['STATUS'] != 1 ? "Desativo" : "Ativo"; ?> </td>
<td class="col-md-1">
<a href="lista-chip.php?id=<?=$chip['ID_CHIP']?>"><img src="imgs/atualizar.png"></a>
<a href="editar-chip.php?id=<?=$chip['ID_CHIP']?>"><img src="imgs/edit.png"></a>
<a onclick="return confirm('Você tem certeza que quer excluir esse item?');" href="remove-chip.php?id=<?=$chip['ID_CHIP']?>"><img src="imgs/remover.png"></a>
</td>
</tr>
<?php
endforeach
?>
</table>
<?php
?> <div class="btn-group">
<button type="button" class="btn btn-default"><a href="chips.php?pagina='$anterior'"> Anterior</a> </button>
<button type="button" class="btn btn-default"><a href="chips.php?pagina='$proximo'">Próxima</br></a> </button>
</div>
<?php include("rodape.php"); ?>
When I click the next button, the following error appears
Warning: mysqli_fetch_assoc () expects parameter 1 to be mysqli_result, boolean given in C: \ xampp \ htdocs \ database_manager \ database.php 25
below function, with line 25. Does anyone help me to append the system correctly?