MySql - Get Min, Max, and 3 random Rows

I want a MySql query to get 5 rows which include min price row, max price row and other 3 random row. Table: ID Product Price 1 data 2 2 data 20 3 data 55 4 data 24 5 data 2 6 data 15 7 data 10 8 data 33 9 ...
more »

2017-06-15 12:06 (7) Answers

json_encode in particular way

so this my php <?php include 'connect.php'; $sql = "SELECT name from startup_schema"; $result = mysqli_query($mysqli, $sql) or die("Error in Selecting " . mysqli_error($mysqli)); $emparray = array(); while ($row = my...
more »

2017-06-15 12:06 (3) Answers

jQuery Unexpected token in JSON for valid input

I am getting the below error. I am not sure where I get the ' symbol in the JSON. I have double checked and sure that the json_encode function of PHP does not add the ' symbol in the first position. I have seen other question and solutions in StackO...
more »

2017-06-15 11:06 (1) Answers

Current day total login time mysql

I am trying to calculate user's login time in hours and mins for current day. I have my session table as id| user_id | logintime |logouttime | isactive 1| 100 | 2017-06-12 22:53:53 |2017-06-13 02:53:53 | 0 2| 100 ...
more »

2017-06-15 11:06 (1) Answers

Remove leading whitespace from xml using php

I need to remove leading white space in below xml, 1 2 <?xml version="1.0" encoding="UTF-8"?> 3 <VAST version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd"> 4 </VAST> I get a...
more »

2017-06-15 11:06 (3) Answers

How to build a Multidimensional array in PHP

I am trying to build a multidimensional array in PHP using an array of string that I am cutting up so the string of 1:wlrb@yahoo.com:7:8.35 becomes "id": "1", "email_address": "wlrb@yahoo.com", "domain": "yahoo.com", "number_of_orders": "7", ...
more »

2017-06-15 10:06 (1) Answers

PHP search shows more than one result

I am trying to make a search for my website where if i search with member certificate no it will show his full details. But in my code when i search for Certificate No : 1 it show details of Certificate no 1, 10, 11,12,13,14,15,.... Is there any way...
more »

2017-06-15 10:06 (4) Answers

Testing PUT in symfony 'php://input' empty

In symfony project I have a PUT method and I try to read data like this: $data = file_get_contents('php://input'); When I use Postman it works, the request is in form-data: key: data value: {"es_title":"edit","es_text":"text edit"} But when I t...
more »

2017-06-15 09:06 (1) Answers

Regarding my code for Google Recaptcha

I'm new to this google Recaptcha thing. I'm trying to figure out which it doesn't work. I have tried several other code and they doesn't work as well which I have no idea why. This is my form code <form name="contact_form" method="post" action=...
more »

2017-06-15 08:06 (3) Answers

Zend Framework 3 Unit Testing

I'm using Zend Framework 3.0.3 and try to testing my application with authentication system and have error reports below: Application\Controller\IndexControllerTest::testIndexActionCanBeAccessed session_regenerate_id(): Cannot regenerate sessio...
more »

2017-06-14 15:06 (0) Answers

How to get dbadapter out of the servicemanager

I try to get the databaseadapter with the following statement: $dbAdapter = $this->getServiceLocator()->get('db'); I get an error "A plugin by the name "getServiceLocator" was not found in the plugin manager Zend\Mvc\Controller\PluginManag...
more »

2017-06-14 13:06 (1) Answers

Automatic canonical tag if GET parameters defined

I was doing some research into page duplicate content for dynamic keyword insertion via a GET parameter if definded, if not it will default to a definded value. Would it be a benefit to set up a quick PHP check in the page head where by if a GET par...
more »

2017-06-14 12:06 (1) Answers

Arrays merging and Json encoding

I generate an unknown number of arrays like this: for ($t=0;$t<2;$t++) { for ($xx=0;$xx<$totf[$t];$xx++) { $otdata[$t][$xx] = array("".$otname[$t][$xx]."" => ['games'=> $otg[$t][$xx], 'mint'=> $otqmint[$t][$xx],...
more »

2017-06-14 11:06 (1) Answers

Magento 2 custom product attribute won't save

I am writing a magento 2 module - am trying to get it to add a custom attribute to every product. My "Setup>InstallData.php" file is successfully adding the attribute to the "eav_attribute" table when installing the module, and the adminhtml is rende...
more »

2017-06-14 11:06 (0) Answers

Accessing Yelp API in PHP

I'm getting started with Yelp API v3 (Fusion). I have created an app, got Client ID and Client Secret. I understand that I need to get a token from Yelp API and then using business ID retrieve json data. I've found the following PHP code: $postDa...
more »

2017-06-13 21:06 (1) Answers

Displaying php result in HTML using AJAX

I am trying to display the result of my php in different <div>-s. My plan is that I make a query in my php and display the result in JSON format. Due to the JSON format my result can be displaying in different <div>. How can I reach that ...
more »

2017-06-13 15:06 (3) Answers

Upload csv file from zend to nodejs server

I'm trying to upload a CSV file from the Zend (1) framework using curl_setopt_array to NodeJs server API using connect-multiparty. When i upload the file i get this error : Error: stream ended unexpectedly at Form. (/nodeapps/dynamicdispla...
more »

2017-06-13 15:06 (0) Answers

Doctrine2 QueryBuilder Join

So, I'm new to doctrine, and I'm trying to do a basic joint, but I guess I'm missing something, on my entities or I don't know for sure. Doctrine Repository: $queryBuilder = $this->createQueryBuilder() ->select('c.*, a.*'...
more »

2017-06-13 12:06 (1) Answers