Category "php"

jQuery Ajax Post with data

why it isn't working. Am trying to call a php file when onclick of a button occurs with some parameters. It is getting executed till alert statement in jsfile.j

PHP Pure functions

I am trying to identify pure functions in PHP code. A pure function is one where both these statements about the function hold: The function always evaluates

Facebook PHP SDK - will not logout properly

I've been searching for hours for the solution to this problem but can't find one that works for me. When i click "Logout" on my site the user information is st

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Having an issue with sqlsrv_query. This is the error I get: PHP Warning: sqlsrv_num_rows() expects parameter 1 to be resource, boolean given Here is the relev

Php, reflection, how to remove "final" declaration?

I want to test a class which is declared: "final class testme" and cannot be mocked. How to remove the "final" keyword with reflections?

Saving Data from form to database using AngularJS and php

I'm pretty new in angular. i created a modal window to user share story and after that show it in body: html <button class="btn btn-primary new-story" n

Download & Save Zoom Recording in directory by PHP

Some time ago this code was working fine. I was able to download a file into a directory by using a copy command but it stopped working. It is no longer downloa

oauth-private.key does not exist or is not readable

So, I imported another project from Bitbucket and tried to launch it using php artisan serve, I always get this error: [LogicException]

uncompressing xml feed gzip deflate php

I am being sent an XML feed which needs to be downloaded in a 'compressed way'. The example I have been given is this: $url = 'http://myurl.com'; $headers[] =

Why is this PHP array not the same?

I'm not understanding why the array: <? $data = array( 'items[0][type]' => 'screenprint'); ?> Is not the same as <? echo $data['items'][0]['typ

mysql_result is defined but mysql_free_result warns it expected a resource

This code tests to see if there was a result before freeing it up: $result = mysql_query($query) or die("$query\n\n" . mysql_error()); $id = mysql_insert_id();

Laravel: Create morphs() relationship nullable

I want to create a one-to-one polymorphic relation allow null relation. Example: Schema::create('ps_assistances', function (Blueprint $table) {

How to set dynamic `home` and `siteurl` in WordPress?

I config the multi-language setting dynamically using the locale filter. Which fetch the sub-domain name to determine the language. function load_custom_langua

WooCommerce "Error processing checkout. Please try again". How do I get more details?

I am writing (actually modifying an existing one) gift card plugin. During checkout, the gift cards are created on a different system through a Web JSON API.

Adding multiple items to WooCommerce cart at once

I have 3 IDs of the different items that I want to add to my shopping cart. I could use https://url.com/shop/cart/?add-to-cart=3001 but when I want to add 3 ite

Doctrine2 Criteria convert 1 to TRUE

I've got a problem with Criteria from Doctrine2. Iusing Criteria to check a SMALLINT type in PostreSQL like this : $criteria = Criteria::create()->where(Crit

How to redirect to another page after n seconds in wordpress without using javascript?

Following problem: I check a condition for a plugins' page in php and if it's false I want to redirect to another page. With PHP it would simply be: header('

Is it possible to use session from kernel console command in laravel?

I'm trying to fetch data from sessions when I run a command in my console, but session always returns an empty array! php artisan command:mycommand Below is

Apply session id from request header

I am not sure if this is possible in Symfony so I came up with a question. The high-level scenario is: A request on the API (built in Symfony) must return the

unable to load your default controller on Codeigniter

This is the error that i am getting. Please make sure the controller specified in your Routes.php file is valid. Let me explain this. In my application i