0

I'm trying to use Cloud Firestore on a Wordpress website with PHP. I'm working on a page where users can view and remove data from their account. I have buttons on the website for removing data that are connected to an HTML form. When I click on the buttons, the page redirects to # and now reflects the new delete. However, when I go back to the original page (without the #), it shows the old data on the page, even though the data is updated in Firebase Console. This happens even if I open the original page in a new tab.

Here is the HTML form code:

<form action="#" method="post">
<input type="text" name="dataid" value="1" style="display:none">
<input type="submit" value="Remove from list">
</form>

I know the code for removing data works because I can see the data being updated in the Firebase Console. Even after the data is updated, when I open the data management page and run this:

print_r($db -> collection("users") -> document(wp_get_current_user() -> user_email) -> snapshot() -> data());

it prints the old data. Is there a way to prevent my website from getting old data or does anyone know why this might be happening?

FuturrCoder
  • 307
  • 3
  • 7
  • You could try to finish the request and close it after doing the request so it does not appear. – Stefan Neacsu Sep 21 '20 at 11:22
  • @StefanNeacsu Which request are you talking about? The request to Cloud Firestore? How do I finish or close the request in PHP? – FuturrCoder Sep 24 '20 at 22:44
  • 1
    You can try using multithreading (https://stackoverflow.com/questions/70855/how-can-one-use-multi-threading-in-php-applications) and see if this would help with the issue on your PHP code – Stefan Neacsu Sep 28 '20 at 12:25

0 Answers0