I'm trying to get the ID of a bank data with PHP. At the time of returning the value, it always comes as 1.
//Obtenho os valores por GET
$description = $_GET['DESC'];
$contentType = $_GET['TYPE'];
$content = $_GET['CONT'];
//Crio meu objeto de acesso ao banco e realizo a query
$dao = new DAO();
$result = $dao->select("SELECT ID_PUBLICATION FROM TB_PUBLICACOES_E_EVENTOS WHERE TXT_DESCRIPTION = :description AND TXT_TYPE = :contentType AND TXT_CONTENT = :content", Array(":description"=>$description, ":contentType"=>$contentType, ":content"=>$content));
//Atribuo o retorno (array) para um int
$id_publication = (int) $result;
//Exibo os dois valores na tela
var_dump($id_publication);
var_dump($result);
The result looks like this to me:
int(1)
array(1) {
[0]=>
array(1) {
["ID_PUBLICATION"]=>
string(1) "8"
}
}
As I understand it, it is returning the number of array positions and assigning the value to my $id_publication
, so it is always 1.
Is it possible to access this value that is returned from the bank?