código apresenta erro

Enviada por bruno 
bruno
código apresenta erro
09 de January de 2018 às 07:07PM
tenho um sistema que anteriormente no mysql não apresentava erro, porém ao migrar para mysqli apresenta erro, segue o codigo do cadastro
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>NPJ - PUC Rio</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="assets/css/bootstrap.min.css" rel="stylesheet">

<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- CSS code from Bootply.com editor -->

<style type="text/css">
html
{
background: url(assets/img/pilotis.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

h4, h5
{
font-weight:bold;
}
.modal-footer { border-top: 0px; }
#loginModal { margin-top: 0px;}
</style>
</head>


<body >

<!--login modal-->
<div id="loginModal" class="modal show" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="text-center">Núcleo de Prática Jurídica</h1><br>
<h4 class="text-center">Eventos cadastrados pela Professora</h4>
</div>
<div class="modal-body">
<form class="form col-md-12 center-block" action='confirmacao.php' method="post">

<?php

include('conexao.php');


$matricula = $_POST['matricula'];

echo "<input type='hidden' name='matricula' value='$matricula'/>";

$senha = $_POST['senha'];
echo "<input type='hidden' name='senha' value='$senha'/>";

//$sqlMatricula = "SELECT * FROM `INSIRANOMEDOBDAQUI` WHERE matricula = $matricula";
$sqlMatricula = "SELECT * FROM `alunossenha` WHERE matricula = $matricula";
$queryMatricula = mysqli_query($conexao,$sqlMatricula);
if($queryMatricula == true)
{
$rowsMatricula = mysqli_num_rows($queryMatricula);
}

//$sqlProfessor = "SELECT * FROM `INSIRANOMEDOBDPROFESSORAQUI` WHERE 1"
$sqlProfessor = "SELECT * FROM `professores` WHERE 1";
$queryProfessor = mysqli_query($conexao,$sqlProfessor);
if($queryProfessor == true)
{
$rowsProfessor = mysqli_num_rows($queryProfessor);
}


if($rowsMatricula>0)
{
$nome = mysqli_result($queryMatricula,0,'nome');
echo "<input type='hidden' name='nome' value='$nome'/>";
$tel = mysqli_result($queryMatricula,0,'telefone');
$email = mysqli_result($queryMatricula,0,'email');

if(strcmp(mysqli_result($queryMatricula,0,'senha'),$senha) != 0)
{
echo "Senha invalida, tente novamente<br>";
echo '<a href=javascript:history.go(-1) class="btn btn-primary btn-lg btn-block">Voltar</a>';
}

else
{

echo '
<table class="table table-bordered table-striped table-hover">
<tbody>';
echo "
<tr>
<td width='30%'><strong>Matricula</strong></td>
<td width='70%'>$matricula</td>
</tr>
";

echo "
<tr>
<td width='30%'><strong>Nome</strong></td>
<td width='70%'>$nome</td>
</tr>
";

echo "
<tr>
<td width='30%'><strong>Telefone</strong></td>
<td width='70%'><input type=\"text\" name=\"tel\" class=\"form-control input-lg\" value=\"$tel\"></td>
</tr>
";

echo "
<tr>
<td width='30%'><strong>Email</strong></td>
<td width='70%'><input type=\"email\" name=\"email\" class=\"form-control input-lg\" value=\"$email\"></td>
</tr>
";

echo "
<tr>
<td width='30%'><strong>Endereço</strong></td>
<td width='70%'><input type=\"text\" name=\"endereco\" class=\"form-control input-lg\" placeholder=\"R. Marquês de São Vicente, 225\"></td>
</tr>
";


echo "
<tr>
<td width='30%'><strong>Titulo da Monografia</strong></td>
<td width='70%'><input type=\"text\" name=\"titulo\" class=\"form-control input-lg\" placeholder=\"Titulo\"></td>
</tr>
";

echo "
<tr>
<td width='30%'><strong>Professor</strong></td>
<td width='70%'>";

echo '<select class="form-control" id="professor" name="professor">';

for($i=0;$i<$rowsProfessor;$i++)
{
$prof = mysqli_real_escape_string(mysqli_free_result($queryProfessor,$i,'nome'));
echo '<option name="'.$prof.'">'.$prof.'</option>;';
}

echo '</select>';

echo "
<tr>
<td width='30%'><strong>Previsão de Formatura</strong></td>
<td width='70%'>";

echo '<select class="form-control" id="formatura" name="formatura">';

$year = date("Y");
$mes = 6;

for($i=0;$i<8;$i++)
{
if($mes == 6)
$data = "0$mes/$year";
else
$data = "$mes/$year";

echo '<option name="'.$data.'">'.$data.'</option>;';
if($i%2==0)
{
$mes = 12;
}
else
{
$mes=6;
$year++;
}
}

echo '</select>';



echo "
</td>
</tr>
";




echo' </tbody>
</table>';
}
}

?>

</br>

<div class=\"form-group\">
<button type="submit" class="btn btn-primary btn-lg btn-block">Cadastrar</button>
</div>
</form>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>

<script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>


<script type='text/javascript' src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>






<!-- JavaScript jQuery code from Bootply.com editor -->

<script type='text/javascript'>

$(document).ready(function() {



});

</script>

</body>
</html>

essa é a linha do erro
Fatal error: Uncaught Error: Call to undefined function mysqli_result() in C:\xampp\htdocs\side\cadastro.php:79 Stack trace: #0 {main} thrown in C:\xampp\htdocs\side\cadastro.php on line 79

alguém já passou por isso e sabe a solucção
Eduardo Molina
Re: código apresenta erro
21 de March de 2018 às 11:05PM
boa noite, aqui vai a melhor dica para quem esta começando ou ja programa a algum tempo com php, aqueles erros que dao no navegador basta copiar e colar no google, sempre tera alguem que ja teve o mesmo problema, e exemplifica o que foi o motivo do problema e muita das vezes a solução.


https://pt.stackoverflow.com/questions/113236/mysqli-n%C3%A3o-exibe-resultados
Você precisa estar logado no PHPBrasil.com para poder enviar mensagens para os nossos fóruns.

Faça o login aqui.