-1
Guys, I want to understand why this is happening,
I used this code;
<table class="table table-striped table-hover" id="dataTables-example">
<thead>
<tr>
<th>Name</th>
<th>Email </th>
<th>Senha</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
include 'database.php';
$pdo = Database::connect();
$sql = 'SELECT * FROM users ORDER BY id DESC';
foreach ($pdo->query($sql) as $row) {
echo '<tr>';
echo '<td>'. $row['zname'] . '</td>';
echo '<td>'. $row['email'] . '</td>';
echo '<td>'. $row['password'] . '</td>';
echo '<td width=100%>';
echo '</td>';
echo '</tr>';
}if ($row >= 1){
$sxURL="tem pedido.php";
echo ("<script>location.href='$sxURL'</script>");
}
else if ($row == 0){
$fxURL="não tem pedido.php";
echo ("<script>location.href='$fxURL'</script>");
}else {
$zxURL="Em análise.php";
echo ("<script>location.href='$zxURL'</script>");
}
Let’s say you go to the status page ( >=1 ) "you have asked.php" ok, but you keep refreshing non-stop.
how to solve this? what is wrong with this code.
Hello, Syntax seems to be correct but this error appears:
Fatal error: Uncaught Error: Call to undefined method PDO::execute() in
– input jobs
Beauty adjusted on top of error and it worked
$q = $pdo->prepare($sql); $q->execute(array($id));
$resultado = $q->fetchAll();
the syntax is totally correct and worked, Thank you!!– input jobs
The function
header()
won’t work!!! To set headers on the page you need no html in the output. It has already displayed a<table>
, then the function will returnCannot modify header information - headers already sent by
– andre_luiss