I am fetching all records from a db table into a page using;
SELECT * FROM table_name;
The page displays a summary of car details:

Now the idea is to create another page that will load the full content of each car. The issue is that I have no idea how to do it. I have searched on the internet but i dont get any results and i am new to php.
MYSQL query would be something like;
SELECT * FROM table_name WHERE id = {$clicked-id}
where clicked id is the previous clicked car. i guess i have to assign an id to each previous car title.
I am quite lost, can someone please help me.
Read the PHP manual, it’s very helpful.
Basically the link should be something like:
So you pass the clicked id in the
idparameter.Then, in your detail page, you retrieve it like this:
I’m using
$_GEThere because the parameter came in the URL. Again, check out the PHP manual, it’s very helpful with this early stuff.Note that I used
intvalto keep SQL injection off my back. You should research about it if you don’t know what it means. The basic idea here is to prevent a user from calling something likedetail.php?id=1;DROP TABLE cars;, which, if not usingintval, would make your query:Which would destroy your data.