This question already has an answer here:
I have this error on my script. Although I'm unsure what it is. This code is to display ONLY the usersID's data from event. I haven't tried anything like this before, but this is my first approach from using session ID to define the users events.
<?php
session_start();
if(!isset($_SESSION["user"]) or !is_array($_SESSION["user"]) or empty($_SESSION["user"])
)
// redirect to index page if not superuser
header('Location: index.php');
?>
<?php
$con=mysqli_connect("localhost","root","Af2vaz93j68","pdo_ret");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM event WHERE userid = '".$_SESSION["user"]["id"]."");
echo "<table border='1'>
<tr>
<th>name</th>
<th>about</th>
<th>website</th>
<th>userid</th>
<th>key</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['about'] . "</td>";
echo "<td>" . $row['website'] . "</td>";
echo "<td>" . $row['userid'] . "</td>";
echo "<td>" . $row['key'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</div>