I have a small PHP script to interact with MAKERIOD. When I execute the select in PHPADMIN I have the return: "Showing records from 0 - 16 (17 total, Query took 8.0945 seconds.)"
SELECT Tbdiario.cn1, Tbdiario.cn2, Tbdiario.cn3, Tbdiario.cn4, Alunos.cnomealu, Tbmateria.cnomemat FROM tbdiario INNER JOIN tbementa ON Tbdiario.ccodementa = Tbementa.ccodementa INNER JOIN tbmateria ON Tbementa.ncodmat = Tbmateria.ncodmat INNER JOIN alunos ON Tbdiario.ncodaluno = Alunos.ncodaluno INNER JOIN tbturma ON Tbementa.ncodtur = Tbturma.ncodtur WHERE Alunos.ccpf = '13922054765' AND Tbturma.cletivo = '2009'
But I want to run this SELECT within a .PHP by passing the CPF and the LEARNING year as parameters. But when I put to run link it gives out time; I have already altered this time limit (which I do not think is correct) but does not return anything.
//include_once 'conexao.php';
require "Dbig.class.php";
Header('Content-Type: application/json');
//$c_cpf = $_POST['c_cpf'] ;
//$c_anoletivo = $_POST['c_anoletivo'];
$db = new Db();
$dados=array();
$sqlBusca = 'SELECT Tbdiario.cn1, Tbdiario.cn2, Tbdiario.cn3, Tbdiario.cn4,';
$sqlBusca .=' Alunos.cnomealu, Tbmateria.cnomemat FROM tbdiario ';
$sqlBusca .=' INNER JOIN tbementa ON Tbdiario.ccodementa = Tbementa.ccodementa ';
$sqlBusca .=' INNER JOIN tbmateria ON Tbementa.ncodmat = Tbmateria.ncodmat ';
$sqlBusca .=' INNER JOIN alunos ON Tbdiario.ncodaluno = Alunos.ncodaluno ';
$sqlBusca .=' INNER JOIN tbturma ON Tbementa.ncodtur = Tbturma.ncodtur ';
$sqlBusca .=' WHERE Alunos.ccpf = "13922054765" ';
$resultado = $db->query($sqlBusca);
if ($resultado)
{
while ($array = mysqli_fetch_assoc($resultado))
{
$dados[] = $array;
}
echo json_encode($dados);
}
else{
echo "VAZIO !!!";
}
? >
<?php
/**
* conexão com o banco de dados usando mysqli
*/
class Db{
private $con;
// Faz a conexão com o banco assim que o objeto é criado
function __construct(){
$this->con = mysqli_connect('localhost', 'root', '', 'dbcadastro');
if (mysqli_connect_errno($this->con)) {
echo "Problemas para conectar no banco. Verifique os dados!";
die();
}
}
// Faz a consulta sql
public function query($sql){
return mysqli_query($this->con, $sql);
}
}
? >