Skip to main content
The 2024 Developer Survey results are live! See the results

PHP Collective

Questions

Browse questions with relevant PHP tags

1,088 questions

Has recommended answer
-1 votes
3 answers
78 views

print numbers between two ranges in PHP? [closed]

Right now, I'm trying to print the numbers in between two ranges assume 1 to 48 and 114 to 118 using a for loop. I tried the following to do this : for ($y = 1; $y < 48; $y++) { } ...
Max Solution's user avatar
Answer

For a solution that is both efficient and easy to read you could use something like this: foreach ([...range(1, 48), ...range(114, 118)] as $number) { echo "$number "; } This makes use ...

View answer
KIKO Software's user avatar
-1 votes
2 answers
55 views

PHP forach array with objects

How can I echo this PHP array with objects in an foreach loop? I want to echo each value in different parts of my code. array(2) { ["new_years_day"]=> object(DateTime)#1 (3) { [&...
Flow's user avatar
  • 11
Answer

As per its documentation, the DateTime class doesn't have any public properties. You need to use the documented getTimezone() function instead, if you want to retrieve the timezone. Since the timezone ...

View answer
ADyson's user avatar
  • 60.1k
0 votes
1 answer
42 views

form serialize is not working after ajax request

I have a modal window that is populated using an AJAX request, and it successfully fills all the fields as expected. The issue is not with the AJAX request itself, as it correctly retrieves the data ...
Lidiia's user avatar
  • 1
Answer

Your form data isn't serialising because let $form = $button.closest('form'); doesn't match an object, therefore $form is empty. It doesn't match anything because the button isn't inside the form. ...

View answer
ADyson's user avatar
  • 60.1k
-6 votes
1 answer
31 views

How to pass data to a webserver [closed]

I'm having a mobile app (osmand), which can trigger HTTP requests in the for of https://example.com?lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5} Now i want to ...
Shaun.M's user avatar
  • 11
Answer

index.php: <?php declare(strict_types=1); $encoded = json_encode($_GET ?? null); assert(is_string($encoded)); is_string($encoded) && error_log($encoded); You find it in the error log you'...

View answer
hakre's user avatar
  • 196k
2 votes
1 answer
52 views

Laravel 11: Is it possible to force PHPUnit to trigger / "press" CTRL+C to simulate interruption of an artisan command?

I have an artisan command that can run for minutes or hours, processing multitude of records in a loop within the handle() method. I have introduced the ability to interrupt such a long process by ...
Matt Komarnicki's user avatar
Answer

With pcntl_signal() you register the signal handler. with posix_kill() you can send a signal (cf. kill(1), full example on the PHP manual pcntl_signal page). Now if you have the process id (PID) of ...

View answer
hakre's user avatar
  • 196k
1 vote
1 answer
40 views

php.ini Path Disagreement

There are two tools commonly used to identify the configuration file path of php.ini. But in my environment, Ubuntu running Apache and PHP 8.2.21, the two tools disagree. From my browser, running a ...
snixdad's user avatar
  • 37
Answer

I'm actually glad you're asking this question in this direkt form: Is this a disagreement? Let's see the observations again: From my browser, running a php which invokes phpinfo() yields: /etc/php/8....

View answer
hakre's user avatar
  • 196k
1 vote
2 answers
90 views

PHP webDav client gives ClientException: SSL certificate problem: unable to get local issuer certificate

I want to upload files to NextCloud via PHP on Windows 11. I do not know PHP much but I managed to install sabre/dav via composer Then I found on the internet simple code sample to list files. <?...
Radek's user avatar
  • 12.7k
Answer

Run composer installer that also ships with the certificates. Then use the composer diagnose command to verify they are available. Then retry with the webdav PHP script. It is perhaps already solved ...

View answer
hakre's user avatar
  • 196k
0 votes
2 answers
42 views

When will a laravel model creation fail without an exception?

I am adding a store method to a controller that will create and save a new model to the database using the following code: public function store(Request $request) { $validated = $request->...
Hoyt Jolly's user avatar
Answer

$team = Team::create($validated); Given that team was actually created (as a new class), $team will be that new object. Therefore, in the very unlikely event that no exception was thrown albeit not ...

View answer
hakre's user avatar
  • 196k
-3 votes
1 answer
108 views

Count file lines containing a 3-letter palindrome outside of square braces which has a corresponding inverted palindrome inside of square braces

I am trying to solve a contrived PHP task/challenge whereby a text file needs to be traversed line-by-line and 3-letter palindromes cumulatively counted if the palindrome outside of square braces has ...
NiKom's user avatar
  • 1
Answer

Because only 1 qualifying palindrome is all that is needed to deem a line as valid (a counter), there is no need to use a lookahead to potentially make multiple matches in a single line. Capture the ...

View answer
mickmackusa's user avatar
  • 46.6k
1 vote
1 answer
53 views

CodeIgniter and Ajax: Dynamic Dependent Dropdown not working

I'm trying to create a Dynamic Dependent Dropdown via Ajax and CodeIgniter 4. However, I could not make it work. Can you help me figure out what's wrong? I'm trying to follow this tutorial online: ...
cjvdg's user avatar
  • 533
Answer Accepted

In the View markup, identify options reliably by assigning the database id as the option value attribute value. In the great majority of cases, relationships should be built on ids, not names. <...

View answer
mickmackusa's user avatar
  • 46.6k
0 votes
2 answers
56 views

Missing required parameter for update route laravel 11

I have an error Missing required parameter for [Route: updatetransaksi] [URI: penjualan/update/{id}] [Missing parameter: id]. web code route::get('/penjualan/edit/{id_penjualan}', [...
Dia Siapa's user avatar
Answer

In Form <form action="{{ route('updatetransaksi', ['id' => $id_penjualan]) }}" method="POST"> use route() instead of url(). URL route won't automatically resolve named ...

View answer
Abdulla Nilam's user avatar
-1 votes
1 answer
40 views

Dynamic menu building and navigation using URL parameters PHP [closed]

<!DOCTYPE html> <html lang="en"> <head> <title>Web Programming using PHP - Coursework 2 - Task 1</title> </head> <body> <header> ...
Muhammad Ali's user avatar
Answer

First, let me bring to your attention that the $activeItem parameter of generateNavMenu() is never used -- that indicates that a re-think and some editing is required. Second, when a pg option is ...

View answer
mickmackusa's user avatar
  • 46.6k
1 vote
1 answer
47 views

Event Color based on Resource / Room Color - Fullcalendar.js PHP MySQL

I want to display the event color / background color based on each room's color (I have 3 different colors for 3 different rooms/resource). But the parsed colors from resources.php wasn't displayed as ...
Bryant CH's user avatar
Answer Accepted

As per the eventDisplay documentation, by default you will only see the dots on timed events in the dayGrid view, not the coloured rectangle. If you want to see that coloured rectangle in the dayGrid ...

View answer
ADyson's user avatar
  • 60.1k
1 vote
1 answer
40 views

Database locked in PHPUnit tests only

In my application SQLite works. But when I create tests in PHPUnit it's locked on the first write. I've hacked in some beginTranaction() and commit() but it still hangs on the commit() call. The test ...
Tac Tacelosky's user avatar
Answer

Have one database for your application and another for your tests. PRAGMA journal_mode=WAL That is the sqlite write ahead log. You observed that enabling WAL prevents the locking during the run of ...

View answer
hakre's user avatar
  • 196k
1 vote
3 answers
86 views

How to force column to be in array if it matches the whole thing?

I have the following MySQL query: SELECT tbPacientesComunicacao.id FROM tbPacientesComunicacao WHERE tbPacientesComunicacao.idRefUser = 1 AND tbPacientesComunicacao.idRefPaciente = 4 AND ...
Cezar Duarte's user avatar
Answer

Because we don't have sample data to test against and because future researchers might need explicit checks for 2 and 8 (not just two rows which contain 2 or 8 which might unintentionally match ...

View answer
mickmackusa's user avatar
  • 46.6k
-1 votes
1 answer
61 views

jQuery Ajax call returns the whole php file raw code

Now I am asking this question after a huge efforts searching for the solution, I know that are a lot of questions that are the same but none of them worked for me, I have three main files, index.html ,...
Ahmed's user avatar
  • 3
Answer Accepted

Make sure you're using a proper webserver and accessing the HTML file via http://localhost/index.html in your browser (assuming you're testing this on your local machine), that your webserver has ...

View answer
ADyson's user avatar
  • 60.1k
0 votes
2 answers
73 views

Create multidimensional structure from grouped aggregate data from an Eloquent query

I want to create a nested JSON object, something like this: [ { "age": 8, "countAll": 3, "gender": [ { "...
Pettonk Kacoa''s user avatar
Answer Accepted

I find your desired output structure to be a little unwieldy. It might make better sense to declare the deeper gender-specific data points as simpler associative elements genderCounts => ['male' =&...

View answer
mickmackusa's user avatar
  • 46.6k
0 votes
2 answers
92 views

Finding all types of end-of-line delimiters in a file [duplicate]

I have the following function to get all of the different types of end-of-line delimiters in a file. There may be one or more, so I want to return an array of all types. function ddtt_get_file_eol( $...
Aristocles's user avatar
Answer Accepted

Let me guess, you are a developer who wants perfect identification of newline sequences regardless of the environment AND you want to keep all of your hair? PHP has had a solution for this for a long ...

View answer
mickmackusa's user avatar
  • 46.6k
0 votes
1 answer
59 views

Auth::user() / auth()->user(), undefined method 'update'

In my code am trying to update the information but I receive error as. i have created a function to update data on logged in users but i am getting the error "undefined method 'update'" even ...
Morax79's user avatar
Answer

You can't use $user->update();. update() is used on query builder or Eloquent model instances only Change $user->update(); to this $user->save(); FYK (Eloquent model) $user = Auth::user(); $...

View answer
Abdulla Nilam's user avatar
-1 votes
1 answer
55 views

PHP Add 0.1 to 0 value for every two weeks past a specified date?

I'm looking to add .1 to the initial value of 0 every two weeks past a specified date. Example: Date = 05-26-2024; InitVal = 0; AddVal = 0.1; The 26th was 4 weeks ago from 06-23-2024 which means 0 ...
c.widow's user avatar
  • 19
Answer Accepted

PHP's time() and strtotime() both reports time in seconds. To know how many weeks there are between your specified date and now we can do: $startDate = '2024-05-26 00:00:01'; $secondsInWeek = 60 * ...

View answer
KIKO Software's user avatar
0 votes
3 answers
103 views

Find Assignation in Condition using a Regex

I need a regex with which I could find if there is any assignation inside conditions. It needs to be as flexible as possible, because I will run this on many .php files to find such mistakes : <?...
Kolobo's user avatar
  • 39
Answer

You can use this /if\s*\(\s*[^!=<>\n]*=[^=\n]*\)/ Example FYI: I don't know what you're trying to archive. I have provided a solution based on your question. (Regex)

View answer
Abdulla Nilam's user avatar
0 votes
1 answer
77 views

Upgrade from php 5.5 to php 8 error (string * int) fix in common

Having a 15-year-old project in hand now with Yii 1.1 and PHP 5.4. After a big decision, planned to upgrade the PHP version 8.0.30 and keep running the project, and almost achieved it. After upgrading,...
Mano Mahe's user avatar
  • 106
Answer

The "Unsupported operand types: string * int" error would only occur if you actually try to multiply text that can't be automatically juggled to a numeric value. e.g. $x = "test" ...

View answer
ADyson's user avatar
  • 60.1k
1 vote
2 answers
65 views

Replace a static build of data with a dynamic way

I'm trying to replace a static way of getting data for a custom SQL by a dynamic way. $filter1 = array( array('id' => 101, 'field' => 'name', 'name' => 'John'), array('id' =&...
Giancarlo's user avatar
  • 389
Answer

I don't know exactly what you are doing AND it doesn't look like good practice, but if you want to search for data based on your generated numeric values, create a lookup array with those numbers as ...

View answer
mickmackusa's user avatar
  • 46.6k
1 vote
1 answer
63 views

issue with Cube Positioning in Multiplayer Game

Issue with Cube Positioning in Three.js and PHP Multiplayer Game I'm developing a multiplayer game where players control cubes (representing themselves) in a 3D environment rendered using Three.js. ...
John's user avatar
  • 13
Answer Accepted

There's a logic error. Your PHP code always updates player 1's position if the session username (presumably the logged-in user?) matches the posted username. But both players can't be player 1! Your ...

View answer
ADyson's user avatar
  • 60.1k
1 vote
1 answer
71 views

Laravel API resource Group by and details from same table

I'm trying to learn Laravel API and been wrapping my head around what should be a simple problem. I have one database table with sales data returning this API resource collection { "id": ...
Johan's user avatar
  • 13
Answer Accepted

There are a few ways to do this. Since you're using resources, you can play around with this In DetailResource public function toArray($request) { return [ 'id' => $this->id, ...

View answer
Abdulla Nilam's user avatar
-1 votes
2 answers
70 views

Stop PHP from clearing a form

I have 2 questions: How do you stop a PHP script from erasing the form fields when you do the submit? I've searched many posts here, most regarding JS which I'm not using. I've tried auto-complete=&...
Dave's user avatar
  • 13
Answer Accepted

It's not php which clears the form. Php doesn't run in your browser. Your browser posts back the form, which means it discards the page it was displaying and loads whatever the URL the form was posted ...

View answer
ADyson's user avatar
  • 60.1k
0 votes
2 answers
87 views

Group 2d Laravel collection by two columns and sum a third column within each group

I have this collection: $stocks = collect( [ ['sku' => '123', 'batch' => '123', 'qty_total' => 1], ['sku' => '1233', 'batch' => '123', 'qty_total' => 2], [...
Maksim Borodov's user avatar
Answer Accepted

Feeding a 2-element array to the groupBy() method only makes more work/handling because it generates an unnecessarily deep structure. Notice how Mohammad's snippet has to reindex (values()), then ...

View answer
mickmackusa's user avatar
  • 46.6k
-3 votes
4 answers
98 views

Matching Keys and getting value in PHP or jquery

I have two arrays Array1 {"Colour":"RASPBERRY","Size":"11"} and a list of products Array2 [ { "ProductID": 33043, "Key": "...
user3050803's user avatar
Answer

A pivot query will be the sensible play here. Group by the product ids, then write conditions to require certain Key-Value pairs. Use a prepared statement. How you execute that prepared statement ...

View answer
mickmackusa's user avatar
  • 46.6k
1 vote
2 answers
98 views

Reverse the order of parenthetically grouped text and reverse the order of parenthetical groups

I have a strings with pattern, something like this: (X,1,1,3),(X,1,1,3),(X,@2,@2,@2,@2,@2,(Y,1)) And I need to extract from this One big array, reverse order, and generate new string: (X,(Y,1),@2,@2,@...
JozefVasko's user avatar
Answer

I don't know how well this will hold up on varied input, but it is designed to be recursive in its splitting, reversing, imploding behavior while preserving the first entry's position in each ...

View answer
mickmackusa's user avatar
  • 46.6k
0 votes
2 answers
75 views

How can I call a REST API in Php

Our client provided me with a REST API that requires a PHP call. However, the documentation accompanying the API is quite scanty, leaving me unsure about how to proceed with calling the service. I ...
sara kvz's user avatar
Answer

Any http client written for php such as curl or guzzle can do it. You can even use file_get_contents if you enjoy torturing yourself. As for the specifics of what to put in the requests, that can only ...

View answer
ADyson's user avatar
  • 60.1k
0 votes
2 answers
52 views

htmlspecialchars() default flags

https://www.php.net/manual/en/function.htmlspecialchars.php flags... The default is ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401. But then below When neither of ENT_COMPAT, ENT_QUOTES, ENT_NOQUOTES is ...
Qiao's user avatar
  • 16.9k
Answer

The default value when passing no $flags parameter is ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 The second part... When neither of ENT_COMPAT, ENT_QUOTES, ENT_NOQUOTES is present, the default is ...

View answer
Phil's user avatar
  • 163k
2 votes
1 answer
46 views

How to Add SSL Certificate to Outdated CakePHP Website with Apple FileMaker Server?

I'm trying to update an outdated CakePHP website and add an SSL certificate. The website is integrated with an Apple FileMaker server. What steps should I follow to achieve this? Any specific ...
Conrado Conchitoro's user avatar
Answer Accepted

An SSL Certificate can be used independent to the underlying Web application as you can make the SSL connection terminate before it reaches the application. Then the traffic is still SSL until the ...

View answer
hakre's user avatar
  • 196k
2 votes
2 answers
55 views

in PHP does pg_query_params takes into consideration the type of parameter passed?

From the documentation it is not clear to me what exactly pg_query_params does when non string parameters are given. pg_query_params (PHP 5 >= 5.1.0, PHP 7, PHP 8) pg_query_params — Submits a ...
George Kourtis's user avatar
Answer

So where is explained what exactly pg_query_params does when called from PHP ? There is no obligation to explain it, however the sources should be freely available and that is what it defines it. ...

View answer
hakre's user avatar
  • 196k
1 vote
1 answer
44 views

PHP combine two associative arrays with different keys

I want to combine two associative arrays with different amount of keys and keep all the keys in the final array even if they are null or empty I have tried array_merge but the keys that are not ...
Jalagui's user avatar
  • 33
Answer Accepted

array_merge will get you most of the way there. I see no evidence that "keys which are not present in both arrays are removed", as you claimed. Before the merge, a quick loop to add in keys ...

View answer
ADyson's user avatar
  • 60.1k
2 votes
4 answers
63 views

Append associatve elements to each row while looping a mysqli query result

I am using the following code to generate additional data for each row of my query result set. while ($row = $table->fetch_array()) { $formula = [ 'tkoSum' => $this->getTkoSum($...
Глеб Цибизов's user avatar
Answer Accepted

Append the additional data using the union operator. while ($row = $table->fetch_array(MYSQLI_ASSOC)) { $containers[] = $row + [ 'tkoSum' => $this->getTkoSum($row['id']), ...

View answer
mickmackusa's user avatar
  • 46.6k
0 votes
1 answer
39 views

Abstract __construct with variable argument count

I have a quite a few DTOs like so: class AccountDTO extends AbstractNestedDTO { public function __construct( FirstNameDTO $firstName, LastNameDTO $lastName, BirthdayDTO $...
Viacheslav Ravdin's user avatar
Answer

So here is my question: is it possible to define a "universal" constructor that will fit all of my NestedDTO? As so often, it depends. What you'd like to do is not possible any longer since ...

View answer
hakre's user avatar
  • 196k
0 votes
1 answer
100 views

How to make a component in module of laravel

I have checked the Laravel documentation, but it only provides information on creating components in the main directory, not within a module. https://laravel.com/docs/11.x/blade#components php artisan ...
Harpreet's user avatar
Answer

Auto-discovery of components is only within the app/View/Components directory and resources/views/components directory. These are the "main director[ies]" only. However, as the yours in ...

View answer
hakre's user avatar
  • 196k
1 vote
1 answer
289 views

Install ext-ftp extension using the official docker image

I am trying to install the php ftp extension without any luck. I am using the official docker PHP image. I am re-building the image with docker compose build --no-cache I've also tried RUN docker-php-...
csandreas1's user avatar
  • 2,212
Answer

Given the Docker image in question is actually or identical to docker.io/library/php:8.3-fpm@sha256:28cfad4b9dfb7c378d861a757a9253e47cc8165b724f113160146fa8a41b48e1 and that you have tried docker-php-...

View answer
hakre's user avatar
  • 196k
0 votes
1 answer
42 views

Why can't `$request->user()` be accessed in global Laravel middleware even when the proper prerequisite middleware is called?

This is more of an academic question than a real-world one, although it stumped me when I came across it in a legacy 5.2 project with misconfigured middleware, and its behavior hasn't changed in ...
sheng's user avatar
  • 1,342
Answer

As far as I know, to use $request->user(), the session middleware must have been executed before this. auth()->user() works independently of the request’s initialization state because it ...

View answer
Abdulla Nilam's user avatar
-3 votes
2 answers
139 views

How to create an environment-aware configuration in Laravel 11?

I'm working on a Laravel 11 project and I need to set up environment-aware configurations that is accessible with config method. For example, I have a constant.php file in the config directory for ...
Anu Tig3r's user avatar
  • 165
Answer

This code might be simpler to what you currently are using: Add this in any service provider register function: public function register() { parent::register(); if (!File::exists(...

View answer
apokryfos's user avatar
  • 40.1k
0 votes
2 answers
74 views

Does usort() behave differently in php 8.2.0 vs php 7.4.33?

I have an associate array like this: $all_works = [ ["title"=>"A Children’s Story", "year"=>"2024"], ["title"=>"Occurred during ...
Coding_with_a_Tractor's user avatar
Answer

As previously mentioned, PHP8 implemented stable sorting and any versions before that made no promises about preserving the original element order. As for cleaning up your code, it can be reduced to ...

View answer
mickmackusa's user avatar
  • 46.6k
1 vote
3 answers
119 views

Writing a regex regular expression to detect IN conditions with the same column name and replace them

My page receives the conditions as strings in an array from somewhere I can't change. The array values look like this: $array_conditions[0] = column1 IN (1, 2, 3, 4) I have a loop set up to go through ...
Victor Canela's user avatar
Answer

If the values in your SQL are coming from variables (that are not completely in your control), then a prepared statement should be generated and the values should be passed in as parameters relating ...

View answer
mickmackusa's user avatar
  • 46.6k
2 votes
1 answer
46 views

Why do my PHPUnit tests in NetBeans run but don't result in any code coverage?

I have Xdebug running and in mode xdebug.mode=develop,coverage. I checked this with phpinfo() and got: Xdebug: Development Helpers ✔ enabled Coverage ✔ enabled I can run my tests, they ...
rhavin's user avatar
  • 1,627
Answer

It's not entirely clear from your question where the configuration gap is, but this one clearly is wrong, and I'll explain afterwards why: <?xml version="1.0"?> <phpunit> <...

View answer
hakre's user avatar
  • 196k
-1 votes
1 answer
53 views

Split text by <br> in PHP scraping result

I am writing a PHP scraping program. The program works smoothly for me but I found the scraping result slightly differs from my expectation. Here is my script $ch = curl_init(); curl_setopt($...
Lo Dennis's user avatar
Answer

If you are going to iterate through an array if urls, you'll need to couple instructions or a parsing function with each url. For the provided url, I'd use XPath to target the desired content. Code: (...

View answer
mickmackusa's user avatar
  • 46.6k
2 votes
1 answer
112 views

PHP Mail to Googlemail. SPF only

i want to send mails via php to googlemail. I created a SPF txt dns record. Do i still need DKIM & DMARC? No mails reach googlemail at the moment. I checked if the spf was active with https://www....
Jules's user avatar
  • 49
Answer Accepted

Google has a lot of published guidance on this topic: Requirements for all senders Starting February 1, 2024, all email senders who send email to Gmail accounts must meet the requirements in this ...

View answer
ADyson's user avatar
  • 60.1k
1 vote
1 answer
115 views

Why mysqli_fetch_assoc reports an exception from a nested loop

I'm using the following code example: $ca=$db->query('SELECT * FROM `clients`'); while ($c=$ca->fetch_assoc()) { try { $mysqli->query('ALTER TABLE `client_'.$c['id'].'_data` ADD ...
Roman  Apanovich's user avatar
Answer

I believe you have discovered a bug in mysqli. It looks like the bug has existed since at least PHP 7.4 and has not been fixed until now. To understand this, you need to understand that mysqli keeps ...

View answer
Dharman's user avatar
  • 32.5k
1 vote
1 answer
43 views

null value that should not exist

little by little but right now I have this error "Attempt to read property "name" on null" and in my database I have the information so that it has to appear in my view, please ...
Jorge Diaz's user avatar
Answer

You're not handling null chaining correctly. You've got this: {{ $user->city && $user->city->country ? $user->city->country->name : 'N/A' }} Which is OK, but then right ...

View answer
Tim Lewis's user avatar
  • 28.8k
3 votes
2 answers
71 views

Why shortcode @php() interfere with @php and @endphp

I am looking for a reason why in blade files (Laravel) code with mixed @php() and @php ... @endphp fails, and works fine with consistent usage of those codes across the file. I've just learned that ...
MacEncrypted's user avatar
Answer Accepted

The issue in my view is the order of operations when processing @php blocks. The relevant source code will first store uncompiled blocks before it actually compiles anything. Uncompiled blocks seem to ...

View answer
apokryfos's user avatar
  • 40.1k
1 vote
1 answer
77 views

Can't delete file properly, error 404 not found

why doesn't my form delete files as it should, laravel displays the error message 404 not found. I created a delete button and issued a form with capital. <button type="button" class=&...
Irfan Chaniago's user avatar
Answer

In HTML, create a proper DELETE route <form action="{{ url('/pengaduan/delete/'.$data->id) }}" method="POST" style="display:inline;"> @csrf @method('...

View answer
Abdulla Nilam's user avatar
-3 votes
1 answer
65 views

how to create subarray into main array [closed]

i have two table in sql database 1st is booking and it has customers details and another is booking_line it has purchased products history by customers now i want both results in a array like ...
Abhinav Goutam's user avatar
Answer

The problem is that you're adding the second row data to the top level of the array, instead of as an item underneath the main row. This should help: while($rowA = $resultA->fetch_assoc()) { $...

View answer
ADyson's user avatar
  • 60.1k


15 30 50 per page
1
2 3 4 5
22