Hi,
I’m not as good in the programming. I need to make a graduaters page where there are maybe 1920 and 1921 and 1922 etc people. The dates when they graduated the school.
When I make the databes 1920 and insert maybe one name and the id is situated with 1920, then I make a new entry 1921 and that id is 21, different than 1920 ID.
If I press on the link “1920” it shows me the data in 1920 table AND data on 1921. I do not want that multiple names from 1921 come to 1920…
People will go to index.php and there will be 1920. They press on it and it will go to nimekiri.php and that would show 1920 graduates. Right now it shows 1920 graduates AND 1921…What’s wrong in my code?
Here are my codes:
- index.php
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = “SELECT aasta, lend_id FROM vilist”;
$result = $conn->query($sql);
echo “
Vilistlased
”;echo “
Aasta (lend)
”;echo “
$conn->close();
?>
</body>
- nimekiri.php
". $row["aasta"]." ". $row["lend_id"]."". "
"; echo " ". $row["enimi"]." ". $row["pnimi"]."". ""; } } else { echo "0 results"; } echo ""; $conn->close(); ?>