1
I can’t seem to do the header location
redirect to a table field.
In this field, you have a PDF document link.
Look at the code:
case 'mostra-id':
$link = Connection::select("SELECT link FROM `arquivos` where id =" . App::$key);
$sql = "update `arquivos` set `acessos`= acessos + 1 where id=" . App::$key;
$dados = Connection::exec($sql);
header('Location: ' . $link['link']);
break;
The link in the table is saved this way: sistema/public/arquivos/pdf/01.pdf
The update is usually correct, but does not open the link when redirecting. Giving the following error:
Fatal error: Cannot use Object of type Pdostatement as array in
I was half in doubt, the link only appears by header Location, but when you put the direct link by the browser it works, correct?
– Victor Eyer
Do
print_r($link);
and put the result here with.– rray
Pdostatement Object ( [queryString] => SELECT link FROM
arquivos
Where id =10 )– Eduehi
You don’t have to execute
$link
to get the BD result?– Jorge B.
Yes, it worked like this: header('Location: ' . $link->fetchColumn(0));
– Eduehi