I have the following code where I get data from the Urls
if (isset($_GET['id'])){
$url = $_GET['id'];
}
I check the value that the variable is giving me $url
as a result:
book-php/
Currently the data is obtained in such a way because I have the file .htaccess
in friendly Urls .
The data is correct at the time of making the query:
$stmtID = $con->prepare("SELECT idlibro,libro,titulo,precio FROM biblioteca WHERE url=?");
Now my question:
What value does he give id
to $_GET
?
If I change this way the code does not work, all the variables of the file lose their validation for the reason that they no longer receive the ideal result for the query.
if (isset($_GET['url'])){
$url = $_GET['url'];
}
What does the in have to do id
with it $_GET
?
I don't have any product or data in the database that has a column ,
id
all IDS are defined like thisid_producto
,id_usuario
etc.
Why giving it another name does not work the same?
Update
.htaccess file
#Regla Url amigable
RewriteRule ^([a-zA-Z0-9-/]+)$ detalle.php?id=$1