Skip to content

Assign filename dynamically in a response

in my web application created with Laravel 8, I need to download an .xml file and the file name must be dynamically created, as per the title. this is because the file name is composed following a specific rule and having to include today’s date. $filename = ‘FirstPart_’.date(“Y-m-d&#8…

How to display fractional part of a decimal in tens in French

I want to display a decimal in words in French. I succeeded doing that using the NumberFormatter class. Here’s my code The output was vingt virgule un sept instead of vingt virgule dix-sept Please how can I fix this? Thanks Answer vingt virgule un sept is correct though. It’s just another way to s…

mysql query in procedural php isn’t returning single field

Trying to retrieve a single field from a mysql table. Here’s the PHP: I then use ajax to retrieve $sigDAT Ajax returns the following result for $sigDAT: [object Object] Ajax returns $signatureDAT (the original data) correctly. $sigDAT and $signatureDAT should have identical value, so I suspect the probl…

Xampp port 80 is use

Port 80 in use by “”C:Apache24binhttpd.exe” -k runservice” with PID 30352! Apache WILL NOT start without the configured ports free! You need to uninstall/disable/reconfigure the blocking application or reconfigure Apache and the Control Panel to listen on a different port Edit : I&#821…

How can I get the average star ratings? PHP Codeigniter

I am creating a rating system where the customer can rate the seller. I am using the rateyo plugin, so there’s a float value on it like 2.9, 3.8, 4.5, etc I would like to get all the values of the seller and get the average from it to display his/her overall total ratings. I am using Codeigniter as a

Sort Array from object

I have an object and store it in an array. However, when outputting the names from the object, I want to sort them by ‘is_main’. Thereby ‘is_main’ with the value 1 should always be in the first place and then ‘is_main’ with the value 0. Here is the Object And my PHP Code: I…

Get collection values without loop in Laravel

I have hotels and services tables with many to many relationship. I want to get services of specific hotel without using foreach or forelse loop from one line of code. This is how I tried to do that: Result I get: Result is an array of values, I want it to be without brackets and quotes. Any suggestions? Answ…