0
I am having a question regarding passing parameters from one page to another. I have tried it in several ways via get. I can even get the parameter, but not all the parameters I can get. In the example below, I can only get the last id registered in the table...
For example:
Through select, I am listing in menu form, in which I pass the id variable of the database table. When I click on the link it redirects me to the page I determined, however, it only takes the last id registered in the table, even presenting a different url, it does not take the id data referring to this...
The code I’m using is as follows::
prepare('SELECT id, categoria FROM teste ORDER BY categoria ASC');
$stmt->execute();
if($stmt->rowCount() > 0)
{
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
extract($row); $Link = "".$row['categoria'].""; ?>
".$Link.""?>
The other page: "page"
prepare('SELECT * FROM teste WHERE id=" . $_GET["id"]');
if($stmt->rowCount() > 0)
while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ // Escreve dados da pessoa } ?>
is that way.
As I said at the beginning, I can only take and view the data of the last id registered in the table. Where is the error?
Can anyone help me with practical examples?
Obs.: I am working the system with Pdo. Since, I thank everyone that in some way can help me to solve this issue. htaccess is configured like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php
I’ve tried other settings on htaccess
, but the problem persists.
Okay, put it on. Me and the others can take a look
– Luciano Bezerra
Please show the code of the pages, there seem to be some syntax errors.
– Jorge Costa