How should my test.php get data from a database? My database name is "example" and the things i want to get are test1, test2, test3.
<html>
<a href="test.php?ID=<?php echo $kerko_rezultatin['id_object'];?>">
</a>
</html
First you need to create a connection to you database:
$conn = mysqli_connect("localhost", "username", "pass",
"db_name");
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
Then you need to create a query to select data from your database:
$sql = "SELECT *
FROM table
WHERE 1";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($kerko_rezultatin = mysqli_fetch_assoc($result)) {
echo "<a href='test.php?ID=".$kerko_rezultatin['id_object']."'> </a>"
;}