-1
I have two inputs date that is to take the date you receive from them and do a search in db to show all products purchased during this date, but is giving the following error:
Fatal error: Uncaught Error: Call to undefined function mysqli_result() in C:\xampp\htdocs\ComFiltro\config\filtro.php:15 Stack trace: #0 C:\xampp\htdocs\ComFiltro\home.php(74): include() #1 {main} thrown in C:\xampp\htdocs\ComFiltro\config\filtro.php on line 15
Here is the html of inputs:
<div class="main">
<h1 class="center port-1 page-header">Portal Guido</h1>
<!-- -->
<div class="jumbotron jumb-1">
<h4 class="center">Informe a data desejada para a busca dos produtos</h4><br>
<form class="form-inline text-center" method="">
<div class="form-group">
<label for="datainicial">Data inicial</label>
<input type="date" class="form-control" id="inicio" name="inicio" placeholder="Data de inicio">
</div>
<!-- -->
<div class="form-group">
<label for="datafinal">Data final</label>
<input type="date" class="form-control" id="fim" name="fim" placeholder="Data final">
</div>
<!-- -->
<button type="submit" id="filtro" name="filtro" value="filtro" class="btn btn-primary">
Buscar
</button>
<?php
include "config/filtro.php";
?>
</form>
</div>
</div> <!--MAIN -->
Here’s the code of how to get the data and trying to pull on db:
<?php
require_once "config/conexao.php";
if (isset($_REQUEST['filtro'])) {
$inicio = $_REQUEST['inicio'];
$fim = $_REQUEST['fim'];
$query = "SELECT * from api_teste WHERE DATEV BETWEEN date('$inicio') AND date('$fim')";
$querySelect = mysqli_query($conn,$query);
if(mysqli_result($querySelect) == true){
$mensagem = "<div class='alert alert-danger'>Há!</div>";
printf ($mensagem);
}else {
$mensagem = "<div class='alert alert-danger'>Por favor coloque uma data válida!</div>";
printf ($mensagem);
}
}
?>
CONNECTION CODE:
<?php
$conn = new mysqli("localhost", "", "", "");
if ($conn->connect_error) {
die("Falha ao conectar!, Motivo: " . $conn->connect_error);
}
Someone knows why it’s not working and how to fix it? No db o DATEV ta como date
My version is 7.1.9 so that’s right
– Maria
@Maria the function has been removed in version 7. See the response again with more attention in the line quoting such version.
– Woss
But is that I did this function on another file and it works normally, tends? do not give any error
– Maria
The Connection string is correct?
– djva
Hmmm, you’re using the
mysqli_query
? Can enter connection code (don’t forget to remove IP, user and password before posting), @Maria?– KaduAmaral
@Kaduamaral, yes, I use mysqli_query. I updated the question with the connection code
– Maria
@Maria updated response. See if you can solve it now.
– KaduAmaral
@Kaduamaral keeps making this mistake in this if
Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\ComFiltro\config\filtro.php on line 16
– Maria
Hi @Maria, it’s just
;
I forgot, I put it there. Always when an error occurs, remember to check the error line and the previous line and see if the syntax is correct.– KaduAmaral