I'm new at PHP and I'm having trouble with an error in a project, I am trying to get data from mysql database, I used the same method for another page and it worked, I don't know why it isn't working, this is the error:
Notice: Undefined index: antari in C:\Users\Personal PC\Desktop\xamp\htdocs\phpushtrime\SMP PROJEKTI\SMP_ver4-perfundimi\inc\functions.php on line 65
Notice: Trying to access array offset on value of type null in C:\Users\Personal PC\Desktop\xamp\htdocs\phpushtrime\SMP PROJEKTI\SMP_ver4-perfundimi\inc\functions.php on line 65
Notice: Undefined index: antari in C:\Users\Personal PC\Desktop\xamp\htdocs\phpushtrime\SMP PROJEKTI\SMP_ver4-perfundimi\inc\functions.php on line 68
Notice: Trying to access array offset on value of type null in C:\Users\Personal PC\Desktop\xamp\htdocs\phpushtrime\SMP PROJEKTI\SMP_ver4-perfundimi\inc\functions.php on line 68
I've tried everything I know to fix it, but the same results.
here is an image of the function
THE CODE FOR THE PAGE:
<?php
$punet = merrPunet();
if ($punet) {
while ($puna = mysqli_fetch_assoc($punet)) {
$pid = $puna['punaid'];
echo "<tr>";
echo "<td>" . $puna['emri'] . "</td>";
echo "<td>" . $puna['data'] . "</td>";
echo "<td>" . $puna['pershkrimi'] . "</td>";
echo "<td><a href='modifikopune.php?pid=$pid'>Edit</a></td>";
echo "<td><a href='fshijpune.php?pid=$pid'>Delete</a></td>";
echo "</tr>";
}
}
?>
THE FUNCTION I USED TO GET DATA FROM DATABASE:
function merrPunet() {
global $dbconn;
$antariid = ($_SESSION['antari']['antariid']);
$sql = "SELECT p.punaid,p.data,p.pershkrimi,pr.emri";
$sql .= " FROM punet p INNER JOIN projektet pr ON p.projektiid=pr.projektiid";
if ($_SESSION['antari']['roli'] == 0) {
$sql .= " WHERE antariid=$antariid";
}
return mysqli_query($dbconn, $sql);
}
Thank You in Advance!
source https://stackoverflow.com/questions/73736256/how-to-fix-this-errornotice-undefined-index-antari-in-c-users-personal-pc-de
No comments:
Post a Comment