0

I have created an admin page for a website, the page shows all records on the database when the user logs in.

My problem is that when the user clicks on the view records button all the records disappear. Im sure i have to inject PHP and SQL into my admin page but cant figure out where to put the code.

Im guessing i need to inject the PHP and SQL into this part of my code...

<form>
     <button type="button" name="viewRecords" id="viewRecords" class="activeButton" onClick="window.location.href='admin.php'">View Records</button>

I cant seem to figure it out.

My admin page has the following PHP script to show the records but when i click on view records it all disappears, and when i delete or update the record it should go back to this and show all records but again it disappears.

<?php

$sql = mysqli_query($con, "SELECT * FROM details INNER JOIN genre ON genre.genreID = details.genreID;") or die(mysqli_error($con));


while($row = mysqli_fetch_array($sql)) {    

    echo '<div class="info-box">

            <img class="image" src='.'"'.$row['image'].'"
            '.'>

            <a class="edit" href="delete.php?id=' . $row["ID"] .'" onclick="return confirm(\'Are you sure you want to delete this record?\')">Delete</a>  |

            <a class="edit" href="edit.php?id=' . $row["ID"] . '" onclick="return confirm(\'Are you sure you want to edit this record?\')">Edit</a>

            <p><b>Name:</b> '
            .$row['photographer_name'].'</p><p><b>Title: </b>'
            .$row['title'].'</p>'.  '<p><b>Genre:</b> '
            .$row['genre_name'].'</p>'.  '<p><b>Description: </b>'
            .$row['description'].'</p>'.  '<p>                  

        </div>'; 

  } 

mysqli_close($con);
?>
Jordan
  • 97
  • 11

0 Answers0