0
This is an information seeker from universities, my TCC.
This is the mistake:
$mysqlli = new mysqli($servidor,$user,$senha,$banco);
if(mysqli_connect_errno()) trigger_error(mysqli_connect_error());
else
echo "sucesso";
//@mysql_select_db("faculdadesbd",$mysqlli);
?>
Unigle
body{
font-family:Verdana, Geneva, sans-Rif;
color:#333;
font-size:12px;
}
<?php
if(isset($_POST['botao'])){
$busca = $_POST['busca'];
$busca_dividida = explode(' ',$busca);
$quant = count($busca_dividida);
for($i=0;$i<$quant;$i++){
$pesquisa = $busca_dividida[$i];
$sql = ("SELECT * FROM busca WHERE nome_fac LIKE '%$.pesquisa.%'");
$query = $mysqlli->query($sql);
while($linha = mysql_fetch_array($sql)){
$nome_fac = $linha['Nome'];
$data_vest = $linha['Data Vestibular'];
$data_taxa = $linha['Data Taxa'];
$nota_corte = $linha['Nota de corte'];
$nota_enem = $linha['Nota ENEM'];
echo"
<div class='resultado'>
<h2>".$nome_fac."</h2>
<p>".$data_vest."</p>
<p>".$data_taxa."</p>
<p>".$nota_corte."</p>
<p>".$nota_enem."</p>
</div>
";
}
}
}
?>
Help us help you. What the error says?
– Thomas
In the other ask was
mysql_fetch_array($sql)
stay tuned to use only a connection driver with the database preferably mysqli. See how the site works on tour, how to ask and don’t forget to debug ;)– rray
I mistook it when pasting the code only.
– Raphael Santos
Place: $query->fetch_assoc()
no lugar de
mysql_fetch_array($sql)`– rray
The following errors occurred when replacing mysql_fetch_array($sql) with $query->fetch_assoc()`: http://i.imgur.com/Qvblwv6.png? 1
– Raphael Santos
In the question code there is no variable called query. Check the variable names if you need to edit the question and enter the correct code.
– rray
The query variable is $query. I’m sorry, I posted the error in Portuguese, here it is in English if it helps: http://i.imgur.com/Glrstal.png
– Raphael Santos
query()
returns false when the query has an error, thus displays the error of the database:$query = $mysqlii->query($sql); if(!$query){ echo $mysqlii->error;}
– rray