I have one table with 4 columns (id, name, surname, url). I want to create unique subpage for each row. (example.com/id?=444). So if I visit example.com?id=444 I will see data from row which has id 444.
Right now I have form where you add data into database:
<form action="motogp.php" method="POST"> <input type="text"
name="name" placeholder="Ime"> <input type="text" name="surname"
placeholder="Priimek"> <input type="text" name="url" placeholder="URL
do slike"> <button type="reset" class="ui button">Počisti</button>
<button type="submit" class="ui positive button">Pošlji</button>
</form>
motogp.php page code:
$sql="INSERT INTO person (name, surname, url)
VALUES
('$_POST[name]','$_POST[sruname]','$_POST[url]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
$result = mysqli_query($con,"SELECT * FROM person ORDER BY id DESC LIMIT 1");
while($row = mysqli_fetch_array($result))
{
echo "<h2>VIDEO: " . $row['name'] . . $row['surname'] . " z drugo zaporedno zmago zmanjšal zaostanek za Marquezom</h2>";
echo "<img src='images/avoter.png'>";
echo "<img src='" . $row['url'] ."'>";
}
Now it gives me just example.com/motogp.php not example.com/?id=444.
example.com/?id=444is shorthand forexample.com/index.php?id=444(or whatever your default DirectoryIndex page is, index.html, etc). Have you created that page?motogp.php. And then you'll have a lot more issues, since that page looks like your "form handler". The page you use to handle form data (the page referenced by your form'sactionshould typically be different than the page you use to view data from the database.