hi everyone, this is my first post in phpbuilder.
i'm going nuts with a function that returns some values from a table, the code works, no mysql or php errors, but the array is not populated.
it's always returning a null value.
every attempt charles webproxy shows me that the result is null.
here is my code:
/**
* Returns the item corresponding to the value specified for the primary key.
*
* Add authorization or any logical checks for secure access to your data
*
* @param string $itemID
* @return stdClass[]
*/
public function getCursoInfoByID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where IDCurso=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 's', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->IDCurso, $row->IDModulo, $row->NomeModulo, $row->ModuloAnterior, $row->ModuloSeguinte, $row->IDUnidade, $row->NomeUnidade, $row->UnidadeAnterior, $row->UnidadeSeguinte, $row->IDTopico, $row->NomeTopico, $row->TopicoAnterior, $row->TopicoSeguinte, $row->IDEcra, $row->NomeEcra, $row->EcraAnterior, $row->EcraSeguinte,$row->NumCreditos,$row->PathEcra);
array_push($rows,$row);
while (mysqli_stmt_fetch($stmt)) {
//$rows[] = $row;
//$row = new stdClass();
//mysqli_stmt_bind_result($stmt, $row->IDCurso, $row->IDModulo, $row->NomeModulo, $row->ModuloAnterior, $row->ModuloSeguinte, $row->IDUnidade, $row->NomeUnidade, $row->UnidadeAnterior, $row->UnidadeSeguinte, $row->IDTopico, $row->NomeTopico, $row->TopicoAnterior, $row->TopicoSeguinte, $row->IDEcra, $row->NomeEcra, $row->EcraAnterior, $row->EcraSeguinte,$row->NumCreditos,$row->PathEcra);
$newstdclass= new stdClass();
mysqli_stmt_bind_result($stmt, $row->IDCurso, $row->IDModulo, $row->NomeModulo, $row->ModuloAnterior, $row->ModuloSeguinte, $row->IDUnidade, $row->NomeUnidade, $row->UnidadeAnterior, $row->UnidadeSeguinte, $row->IDTopico, $row->NomeTopico, $row->TopicoAnterior, $row->TopicoSeguinte, $row->IDEcra, $row->NomeEcra, $row->EcraAnterior, $row->EcraSeguinte,$row->NumCreditos,$row->PathEcra);
$newstdclass= $row;
array_push($rows,$newstdclass);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
help would be appreciated
thanks in advance