Until quite recently, the above code would read each record in the database, but now it only reads the first record, and I'm unsure why.
With the above code, I'm in the process of re-writing the login screen.

At present, I've created a basic form signup form.
When the form is submitted, it is encrypted using the code below, and got the last ID number from the database (ie. $last_id = $conn->lastInsertId();)
Then I copied a png file from another location and renamed it to $last_id.png
Then I typed $_SESSION['photo_id'] = $last_id."png";

Finally just before I update the database, I would like to re-encrypt $_SESSION['photo_id'] which I can't seem to do.