Skip to content

Prepared statement mysqli SELECT * FROM users

Can someone please tell me what I’m doing wrong. I am trying to select everything from users and then I want to use the [‘password’] and den [‘verified’] strings from the database, where it says ‘//…

Return data from 2 pivot tables

I have products, categories, sizes tables and also have 2 pivot tables named category_product and product_size in my database. I am trying to get products belong to a specific category and I need to …

Return occurence of letters in order in the string

I made this code to return the number of occurrences of letters in a string. this function returns ‘6a3b5y’ but I want it to respect the order and display ‘4a3b2a5y’ how to change it to display ‘4a3b2a5y’ ? Answer Use a variable to hold the previous character. Compare the c…

Why is my session unset/ destroy not working?

On my page I have a session being created which can be accessed and called fine usually. However, I am adding a logout button which links to logout.php which only contains the lines session_unset(); …

How can I run php artisan serve using .env.production?

I have a Laravel Web Application, and it works just fine locally, using a local .env file that references the local database. I have the same Laravel Web Application deployed in production, where I find a .env, which is different from the one that I use locally. Both the scenarios work perfectly, but when I w…

php.ini updates not reflected in phpinfo() output

I am trying to update memory_limit in php.ini, but I don’t see the value updated in phpinfo(). Here is the ini file path info from phpinfo(): Configuration File (php.ini) Path: /etc Loaded …

Migrate to PHP 8.0: Unbinding $this when $this is used

Step by step, I am migrating my project(s) from PHP 7.1 to PHP 8.0. In the official PHP manual, in the subchapter “Deprecated Features” of the chapter “Migrating from PHP 7.3.x to PHP 7.4.x”, I tried to understand the following deprecation description: Unbinding $this when $this is use…