You could try something like this to generate “different” page using one file only(example.com/title.php
)
Loop through your database to get all data while creating a <a>
for each of them:
foreach ($retrieveResult as $result) {
echo '<a href="https://stackoverflow.com/questions/44427393/example.com/title.php?name=".$result["title'].'">'.$result['title'].'</a>';
}
This will generate something like this:
<a href="https://stackoverflow.com/questions/44427393/example.com/title.php?name=titleA">titleA</a>
<a href="example.com/title.php?name=titleB">titleB</a>
<a href="example.com/title.php?name=titleC">titleC</a>
<a href="example.com/title.php?name=titleD">titleD</a>
To get the value of name
in the url, use $_GET
in title.php
$title = "";
if(isset($_GET['name')){
$title = $_GET['name'];
}
Now put $title
in a SELECT
query to retrieve all data that has the title of $title
, then display it in title.php
. With this you will have a dynamic page.
solved How to do i create a unique page for each row in database with PHP?