Not done any php database work for years, fairly simple question I'm sure for anyone with experience, below is my code it should take all the results from the database and display these to a table with links:
<?php
include('session.php');
?>
<html">
<head>
<title>Welcome </title>
</head>
<body>
<h1>Welcome <?php echo $login_session; ?></h1>
<form method="post" action="upload.php" enctype="multipart/form-data">
<p>File:</p>
<input type="file" name="Filename">
<p>Description:</p>
<textarea rows="10" cols="35" name="Description"></textarea>
<br/>
<input TYPE="submit" name="upload" value="Submit"/>
</form>
<hr/>
<p>Uploaded Files</p>
<?php
//include('config.php');
$query1=mysqli_query($db,"SELECT filepath,filename,description FROM `filedetails`");
echo "<table><tr><td>filepath</td><td>filename</td><td></td><td></td>";
while($query2=mysql_fetch_array($query1))
{
echo "<tr><td>".$query2['filepath']."</td>";
echo "<td>".$query2['filename']."</td>";
echo "<td><a href='edit.php?id=".$query2['id']."'>Edit</a></td>";
echo "<td><a href='delete.php?id=".$query2['id']."'>x</a></td><tr>";
}
?>
<h2><a href = "logout.php">Sign Out</a></h2>
</body>
</html>
So the line it's failing on is
while($query2=mysql_fetch_array($query1))
The error message is:
Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in C:\xampp\htdocs\welcome.php on line 27
mysqli_query)and MySQL (mysql_fetch_array) syntax. MySQL functions are deprecated in PHP 5.5, and removed in PHP 7, so please don't use it.