Skip to content

Tag: php

Partition array into multiple arrays, by hours

I have a PHP array like this : Pastebin Array Exemple Each array element have a key TIME. I would like to split this array by hours. Example : Each array elements with key TIME between 8h – 8h59 = 1 Array Each array elements with key TIME between 9h – 9h59 = 1 Array Each array elements with key

How to use mysqli_query() in PHP?

I’m coding in PHP. I have the following mySQL table: I’m trying to use the mysqli_query function in PHP to DESCRIBE the table. Here’s my code: The documentation says For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. But from there I d…

Check if a User Has a Gravatar [WordPress]

Thanks Rene Korss for helping to resolve the issue almost and be there every time to reply in discussion. I want to check if the user who has posted comment is having an avatar or not? If user has avatar (means having gravatar account) show gravatar avatar else show image which I have defined in else portion.…

Apache does not have write permission on html folder

I installed apache, MySQL, PHP in CentOS 7. All work well, except apache cannot write file in html folder. I found this problem when I used file_put_contents. I tried Change owner of /var/www to apache:apache, not work Added Order allow,deny Allow from all to <Directory “/var/www/html”> in h…

Laravel Image Quality

Every time I upload a new image to my server, this image is resized. The main issue I’m having is that the image is losing a lot of quality. This is the current code: $name1 = str_random(10); …