Skip to content

Remove first result in JSON

I’m using GoogleCharts. I have a problem with the first result. I need to remove the first result in “rows”. I tried with array_shift but I got an error. $q = Database::connect()->prepare(“SELECT …

Create and fill combo box with mysql data with php

I have done google searches and found several answers but I cannot get this to work. I am trying to read a field from ym mysql database and create and populate a combo box containing those values. The …

Setting Cookie on click

I’m having an issue creating / setting a cookie on the click of a link, is there a proper way to do this? Either PHP or Javascript is fine. Obviously both JS and PHP wouldn’t exist in the same instance it was just to show what I have. Answer You can’t mix JavaScript and PHP. By the time your…

How to find average from array in php?

Example: Actually how to find average value from this array excluding empty. please help to resolve this problem. Answer first you need to remove empty values, otherwise average will be not accurate. so DEMO More concise and recommended way See here

Response logging in AWS PHP SDK v3

In v2 of the AWS PHP SDK, I was able to setup logging of request and response information by simply doing this: In v3, I cannot seem to find the solution. Middlewares do not seem helpful as they only fire before the request is sent, and thus I cannot access the response HTTP code. Guzzle v6 has this feature b…

Laravel 5.1 – Checking a Database Connection

I am trying to check if a database is connected in Laravel. I’ve looked around the documentation and can’t find anything. The closest thing I’ve found is this, but this doesn’t solve my problem. I have three instances of MySQL that are set up on different machines. Below is a simplifie…