Category "php"

Combine multiple columns into an array as one of the key in a results set

I am having trouble placing data into its right structure. I have a result set data of: array ( 0 => array ( 'company_id' => 1, 'company_ab

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

From PHP I would like to call a stored procedure in MySQL. The procedure takes input and output parameters -- not "INOUT" parameters. For a simple example, sa

Laravel implode array items to new lines

Here is my array from hasMany relationship in Laravel framework. $array = ['php','css','hrml']; How can I display as below using implode function. (code in m

Nginx disallowing execution of PHP in uploads directory with Magento

I'm having difficulties getting nginx to stop execution of PHP in an uploads directory on a magento install. I've tried many combinations of directives that sh

How to Make Laravel Eloquent "IN" Query?

I want to make query in Laravel Eloquent like here its raw MySQL query SELECT * from exampleTbl where id in(1,2,3,4) I have tried this in Laravel Eloquent

MongoDB Duplicate Documents even after adding unique key

I have created a collection and added a unique key like this db.user_services.createIndex({"uid":1 , "sid": 1},{unique:true,dropDups: true}) The collection

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

I am trying to find out how to add in Metadata or headers (Expires, CacheControl etc.) to a file uploaded using the Laravel 5.0 Storage facade. I have use the p

Hide specific products from unlogged users based in product category in WooCommerce

I have a certain product category that I only want to offer to logged in users. How would I implement that? So how to hide specific products from unlogged user

PHP array stringify

In a lyrics application I'm coding, I'm using an array to print an artists table. The artists array looks like this: $artists = [ [ "Avril Lavigne"

Laravel lang slug in url

I've followed this article to add multi language into my app and it's working fine, the only issue i need to solve is that languages slug won't add to the url.

Laravel IOC Binding Question - getting 500 error

I keep gettings a 500 errors, appdebug = true, but it doesn't show me exactly what the problem is. It logs all other 500 just fine. I can make the 500 errors go

Why am I getting this FedEx API error 'The given grant_type is not supported. Please modify your request and try again'

I'm using this PHP code: $service_url = 'https://apis-sandbox.fedex.com/oauth/token'; $curl = curl_init($service_url); $curl_post_data = array( "co

Lost connection to MySQL server during query In codeigniter query ,Live site

I'm getting the following error on my live site. "Error Number: 2013 Lost connection to MySQL server during query" It was working fine before a day but now the

Laravel Displaying image from database

so i wanted to display the image not the image name in my views. i got this in my views <img src="{{$post->image}}" /> what i want is to display t

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

i'm trying to learn mysqli. i get this error: Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() in C:\xampp\h

PHP and WebView - Cookie doesn't are the same

I'm using a WebView to show a web application. All works, except one thing: My login: setcookie("USER_ID", $my_id, time() + 86400); My logout: setcookie("U

PHP Download MP3 files from directory on server

I am attempting to download MP3 files to the user computer located in a directory named "songs" on the server. I have been able to run a script which downloads

Laravel websockets AWS EC2 - Connection failed

I'm using laravel-websockets and is working like a charm in my local docker machine but I can't seem to make it work when I deploy it in the AWS EC2 machine. Th

Correct way to use LIKE '%{$var}%' with prepared statements?

This does not work $sql = 'SELECT * FROM `users` WHERE username LIKE \'%{?}%\' '; Warning: mysqli_stmt::bind_param(): Number of variables doesn't match numbe

Exact alternate to mcrypt_encrypt in PHP 7.2

Since mcrypt_encrypt is no longer supported in PHP 7.2, I am trying for exact alternate to this function. After reading many SO answers I have found the foll