Category "php"

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

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

My log shows a lot of the following messages: order_total was called incorrectly. Order properties should not be accessed directly. This message was added in v

MySQL Filter JSON_CONTAINS Any value from Array

I have a JSON field in a MySQL database that contains values like [1,3,4,7]. I would like to be able to easily supply another array from a PHP variable and det

CodeIgniter Fatal error: Cannot redeclare class

I'm getting the error: Fatal error: Cannot redeclare class News in application\models\Entities\News.php The two classes are as follow: application/models/News

Move a child array to parent array and change parent/child name

I know probably this was asked before not sure if was in this form but I did tried some replay from what I found here about this and failed. ok I have this arr

Telegram bot doesn't answer

I'm using the package of eleirbag89 http://eleirbag89.github.io/TelegramBotPHP to create my bot on telegram. I'm having some issues on it, it doesn't answer me

How do I call Validator from a namespace with an already existing Validator class

I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call th

Get orders by date and status woocommerce

I need get a list of orders in woocommerce passing start date, final date and status. I tryed use some techniques like described by Mike Jolley, and I mixed wi

Which is faster php date functions or carbon?

Carbon is simple PHP API extension for DateTime. I want to know that we can use datetime functions using by installing carbon via composer. which is faster ph

Sync AWS Elasticache(Redis) to MySQL Database Table

I am using AWS Elasicache(Redis) using PHP & MySQL for different caching purposes that are mentioned below Reducing the load on MySQL Session Handling Datab

(Laravel) How to delete multiple models including optional relationships?

Summary I'm trying to let my model controller delete multiple models (selected by an array of IDs) including their selected related models (selected by an arra

Call to undefined function openssl_decrypt

When I try to make a request with POST to a script that has this line: $decrypted_data = openssl_decrypt($encrypted_data, 'AES-256-CBC', $key); I get the fol

How can I send a Carousel like message in Telegram bot?

I've been searching for something like this https://cdn-images-1.medium.com/max/800/1*pLXaOT2WwxRptVxOvuvX8w.png in Telegram to no avail. Anyone out there can p

Auto increment id JSON

I'm making a RESTful webservice and I want the items that are posted to the JSON file to have an Id. I've been searching everywhere but couldn't find anything o