Skip to content

Dont print empty json arrays in php

Im programming a website where I can query server details from a game server. The problem is, that Ark sometimes prints empty playernames. That happens because there connecting at this moment or because they’re bots. I dont want to show them on my website. The problem is, that i don’t know how to …

Hide item from array

I am showing the product categories on the WooCommerce thank you page using this piece of code: The code above shows all categories, but I need to hide a specific category. Is it possible to hide a specific category by ID in the above code? Answer Woocommerce uses main get_categories() function from WordPress…

Token for preventing CSRF attacks not validating

I am trying to add a token to my forms in order to prevent CSRF attacks But the token validation isn’t working Here is the input field which holds the token And here is the token validation code It doesn’t work and it returns the error message in the if block Answer I presume that the submitted au…

php table update multiple records at one time

I have a table that retrieves the username and availability status from the users table. Right now in my testing database I have 3 records. If I try to change the availability field for any of them, noting in updated. This is my availability.php file (the first line keeps getting cut off): Here is my av_updat…