Skip to main content

PHP Collective

Questions

Browse questions with relevant PHP tags

2,346 questions

Has recommended answer
Best practices
2 votes
14 replies
203 views

Does my code look secure? And How do I prevent people from entering a page?

To practice php I created a login system that only works for 1 user, and if you type in the wrong username/password it will kick you out. If you type the right one it sends you to a devtools.php. I'm ...
Krombopulos Michael's user avatar
Answer

Wondering here... if it is secure in a technical sense, in which other non-technical sense it is not secure? Words do matter. I do however agree that many of the comments are badly worded, and don't ...

View answer
KIKO Software's user avatar
1 vote
2 answers
87 views

How to toggle bootstrap nav pane from a button

I have successfully implemented a tabbed pane design with collapse for small screens. On one of the panes I would like to include a button which toggles to another pane. I have tried unsuccessfully ...
pcla56's user avatar
  • 33
Answer Accepted

As mentioned, there are a few issues wrong usage document.getElementById('#nav-volunteers') #getElementById must NOT include # Invalid syntax - tabElement.show(); # .show() is not a native DOM method ...

View answer
Abdulla Nilam's user avatar
Advice
1 vote
4 replies
163 views

Confused which one to take: js or php for back end (Laravel or Node.js)

I am currently learning Laravel PHP, but I feel a bit confused. From what I see, there seems to be less demand for Laravel at the moment. On the other hand, I hear that JavaScript—especially Node.js ...
Luay Salam's user avatar
Answer

Keep in mind the skills you acquire in web development are largely transferable. There's nothing preventing you from say, learning how to build a web app or an api using Laravel and then trying to ...

View answer
apokryfos's user avatar
  • 41k
1 vote
2 answers
75 views

Laravel localization using session not applying globally (locale changes in session but app()->getLocale() stays unchanged)

I am trying to implement localization (English/Japanese) in a Laravel 12 project using session-based language switching. I have a route to switch language: Route::get('/lang/{locale}', function ($...
Jonathan Batey's user avatar
Answer

This is not a translation file issue. It is a request lifecycle/middleware registration issue. And in Laravel 11/12, middleware registration is typically done in bootstrap/app.php, not app/Http/Kernel....

View answer
Abdulla Nilam's user avatar
Tooling
1 vote
1 replies
42 views

Recommended tool for sending WordPress form data to REST APIs with Bearer Token auth?

I am looking for a reliable way to connect various WordPress form builders (specifically Gravity Forms and Elementor) to an external CRM via a REST API. The requirements are: Support for Bearer Token ...
IT Path Solutions's user avatar
Answer

Any HTTP client library like cURL or Guzzle will do this job

View answer
ADyson's user avatar
  • 63.1k
Advice
1 vote
2 replies
74 views

Magento stable version

I'm currently using Magento 2.4.5. I'm thinking of upgrading it due to slow website, random server errors at admin side. I have never conducted this kind of operation. What are the stable and ...
Vismaya Hostcurator's user avatar
Answer

https://magento.stackexchange.com/questions/368385/how-to-upgrade-magento-from-2-4-1-to-2-4-6 has a guide, different version numbers but the same principles ought to apply. What have you researched or ...

View answer
ADyson's user avatar
  • 63.1k
Advice
0 votes
11 replies
170 views

turn my html+css+php code into a PDF as an email attachment

I've "designed" a business card template using HTML and CSS: This is my HTML code (with some php): <div class="businessCard"> <div class="logo img"><...
ThomasK's user avatar
  • 2,240
Answer

Possibly your system is lacking a relevant root certificate or something like that. There may be some existing solutions out there

View answer
ADyson's user avatar
  • 63.1k
Advice
1 vote
5 replies
109 views

How do you correctly enforce only one active row per user with Doctrine and PostgreSQL under concurrent requests?

I ran into a design problem in a Symfony + Doctrine + PostgreSQL project and I want to make sure I am solving it at the correct layer. I have an entity where one user can have many rows, but only one ...
RangeLead's user avatar
Answer

logic and feeling should normally go together, so not only see but first of all feel the logic. you don't solve constraints. you define them, then you use a system that can guarantee them. if you're ...

View answer
hakre's user avatar
  • 200k
Best practices
2 votes
5 replies
157 views

PHP switch statements for mixing scalars and objects

Is it considered bad practice if you use PHP's switch statement for mixing scalars and objects? For example: $myIntegerOrComplexObject = getIntOrObject(); switch( $myIntegerOrComplexObject ) { ...
McK's user avatar
  • 702
Answer

Why would you ever want to do this anyway? What is the real-world coding scenario that would mean you have a variable where you can't predict whether it'll end up being an integer or an object at ...

View answer
ADyson's user avatar
  • 63.1k
Advice
0 votes
16 replies
175 views

Is this JS script vulnerable to XSS?

Okay so i have a JS function that take my server response that would be multiple html Elements. I add all of those elements with innerHTML and i know it can cause XSS attack but i struggle to ...
frederic chippaux's user avatar
Answer

Your usage of htmlspecialchars() is inappropriate and potentially problematic. htmlspecialchars() is an output filter, only to be used specifically when outputting data into a HTML document. It is ...

View answer
ADyson's user avatar
  • 63.1k
Best practices
0 votes
6 replies
142 views

How can I safely generate deterministic cache keys for complex PHP arrays (including objects) without risking collisions?

I'm building a caching layer in a PHP application where cache keys must be generated from input parameters. The parameters can be nested arrays or objects, and I need a deterministic cache key that ...
Web Marketing Solution Network's user avatar
Answer

I use json_encode(). In general it seems to be faster, but this isn't always true. It doesn't really matter what you use. Both, for instance, allow you to define custom algorithms. However, serialize()...

View answer
KIKO Software's user avatar
Best practices
1 vote
7 replies
153 views

PHP arrays or SQL query in loop?

Which code is preferred and why? Using a query in a loop, but with id search, so it should be quick. $pray_res = sql_query($conn, "SELECT * FROM prayer_stats ORDER BY year DESC, month DESC"...
Phoenixy's user avatar
  • 114
Answer

Put them in the same database then, or link the database. Having relational tables in separate databases is a poor design, really, and creates problems like this one that don't need to exist

View answer
ADyson's user avatar
  • 63.1k
Advice
0 votes
3 replies
146 views

Displaying information from php arrays in html

I have an apache webserver and a browser plugin. The Plugin does check form which website something is downloaded from and checks if it is downloaded from a specific domain. If so it fetches some data ...
user avatar
Answer

It's very unclear where you're stuck. Your title is clear (but you could easily Google that to get existing examples), however your description is then long, rambling and doesn't really get to the ...

View answer
ADyson's user avatar
  • 63.1k
Best practices
1 vote
3 replies
97 views

Tracking GTM real login/registration form conversion (not button click) - same GA4 ID on prod & preprod, AJAX form, no thank-you page

I'm working on a GTM implementation to track successful login and account registration conversions on a client's customer peprod portal. One important constraint I discovered after joining the project:...
Ir_Cem's user avatar
  • 1
Answer

I would have thought that seeing some code would really help here. Also why is this in the "best practices" category? It sounds more like a technical/troubleshooting question.

View answer
ADyson's user avatar
  • 63.1k
Advice
0 votes
2 replies
69 views

Code for website where membership profiles are shown only to those who fit criteria

I want some advice for a website i'd like to launch, it will probably also have data saved to MySQL but i'm open to suggestions. I want to create a website with members, kind of like a social friends ...
kalink's user avatar
  • 1
Answer

Well, the page that displays lists of profiles will need an algorithm to determine who is a match and who isn't, by checking against all the criteria. A SQL query against the profile table which has ...

View answer
ADyson's user avatar
  • 63.1k
Best practices
2 votes
4 replies
71 views

How do I differentiate each device so that each one has its own unique refresh token linked to the same account?

I am designing a mobile application with a user login system. I am going to implement refresh tokens in order to allow for users to only have to log in once every 30 days. How do I differentiate each ...
Calax's user avatar
  • 91
Answer

Tokens are often connected to certain device properties, to prevent session hijacking. I cannot judge, from what you wrote, how big a risk this is for your application. Thinking about the actual ...

View answer
KIKO Software's user avatar
Advice
0 votes
20 replies
6k views

Get a single data entry from a custom database table in WordPress?

I added a custom table to my database and I want to call on a particular row as defined by the ID and then display the string contents of another column in that row. The user makes a selection from a ...
Steve's user avatar
  • 39
Answer

You have no evidence that the variable is a string. But yes it's better to use prepare(), either way.

View answer
ADyson's user avatar
  • 63.1k
Advice
0 votes
3 replies
76 views

Issues converting Figma designs to a full WordPress theme using Open AI

What I am trying to do Fetch design data (frames, components, styles) from Figma using the Figma API Process that data and send it to the Open AI API Generate: WordPress theme structure PHP ...
Shibashish Mohapatra's user avatar
Answer

Agree with the previous comment - please focus it down to one specific issue that you're facing. That'll make it easier for people to respond, make the discussion more coherent, and make it easier to ...

View answer
ADyson's user avatar
  • 63.1k
Best practices
0 votes
3 replies
44 views

How does the_excerpt() decide the length of text in a custom WordPress theme?

I am building a custom WordPress theme and using the_excerpt() inside index.php. I want to understand: How WordPress decides the excerpt length by default Whether it is affected by theme or core ...
A.Aryan's user avatar
Answer

Seconded. What puzzles me is why people don't just search - it requires a tiny bit more effort but they'd get their answer a lot faster than waiting for us google it for them (or to tell them to ...

View answer
ADyson's user avatar
  • 63.1k
1 vote
1 answer
152 views

Use middleware except if auth user is admin

I have a small app where users have to subscribe to post topics. I use Laravel Cashier with Stripe and it works fine. I have created a middleware to check if auth::user() is subscribed or not : public ...
Gastono's user avatar
  • 33
Answer Accepted

You can simply add this in your middleware. above if (! $request->user()?->subscribedToPrice // Now Admins can pass without subscription if ($user->roles->pluck('name')->contains('admin'...

View answer
Abdulla Nilam's user avatar
Best practices
0 votes
11 replies
393 views

How can I fix the "exceeded quota" issue when using AI to generate articles in Laravel?

I am working on a blogging application in Laravel 8, which I named "Brave CMS". I have recently added a "Write with AI" feature to the CMS. In ArticleAIController.php I have: class ...
Razvan Zamfir's user avatar
Answer

Well OK but that certainly doesn't mean you're automatically entitled to another company giving you free use of their AI services. It's not really clear why you seemed to think that would be likely.

View answer
ADyson's user avatar
  • 63.1k
Advice
1 vote
13 replies
6k views

PHP Variable Naming

If I have several variables that are only differentiated by a numerical value within the variable name, is there a way to make the numerical value a variable itself and then pass that value to another ...
Realto619's user avatar
  • 113
Answer

Well this can be done with variable variables, but only like this: $tbl_Fld_type = ${"tbl" . $_tbl . "Fld_type"}; $tbl_FormTypes = ${"tbl" . $_tbl . "FormTypes"...

View answer
KIKO Software's user avatar
Advice
0 votes
9 replies
235 views

PHP shorthand for isset && truthy

Is there a shorter way to write the following in php? $bar = isset($foo['bar']) && $foo['bar']; or $verylongname = isset($_POST['verylongname']) && $_POST['verylongname']; I'm using ...
2Bias's user avatar
  • 61
Answer

The knowledge sought in this question already exists on this platform: Why check both isset() and !empty() ...15 years ago.

View answer
mickmackusa's user avatar
  • 49.5k
2 votes
2 answers
163 views

imap_utf8 not always converting utf-8 text

I have the following simple script, running under PHP 8.3.6 <?php $original = '"=?utf-8?Q?part1=40part2.com?=" <[email protected]>' ; $converted = imap_utf8($original) ; printf("...
Dennis 's user avatar
  • 1,325
Answer

imap_utf8() is not a general RFC-2047 decoder and it only decodes valid RFC-2047 encoded words. Seems your input is not a single encoded word. It's a header-style string RFC-2047 explicitly states: ...

View answer
Abdulla Nilam's user avatar
0 votes
3 answers
204 views

Example .gitlab-ci.yml for Laravel 12 with MariaDB that seeds database before running php artisan test

I'm setting up a GitLab Runner for a Laravel 12 project and I want my CI pipeline to do the following: Spin up a MariaDB service for the tests Run php artisan migrate:fresh --seed to seed the ...
Kektuto's user avatar
  • 160
Answer

When you execute the end-to-end test integrating your code with the database migrations and database handling, you need to set-up (provision) the whole test-system first. By default examples the ...

View answer
hakre's user avatar
  • 200k
Advice
4 votes
5 replies
110 views

Does PHP Header Location Send HTTP Referrer information?

header('Location: https://www.example.com'); => Will send this HTTP Referrer information?. I want to remove HTTP Referrer information, i am trying like header('Referrer-Policy: no-referrer'); ...
Sted's user avatar
  • 103
Answer

Am I doing right...well what happens when you try it?

View answer
ADyson's user avatar
  • 63.1k
Best practices
0 votes
4 replies
99 views

My own OAuth server for authentication on my client application with the ROPC flow

Is it relevant to develop my own OAuth server for authentication on my client application with the ROPC flow? In this scenario, where I manage user login information in both cases, is the ROPC flow ...
Vebama Wanematou's user avatar
Answer

Not sure on what your motivations are to develop your own OAuth2 server capable of an ROPC flow. If you own the server as well as the client application does your OAuth2 server implementation need ...

View answer
apokryfos's user avatar
  • 41k
Advice
1 vote
8 replies
70 views

Changes to the XAMPP httpd main server config file to alter home path for PHP files

I'm not sure if this is possible or not, but I would like to use the same files locally in XAMPP that I use for a shared hosting account without changing the local files themselves. I have it working ...
Realto619's user avatar
  • 113
Answer

Provide ad-hoc configuration and use the production defaults in case of not set: https://www.php.net/get_cfg_var

View answer
hakre's user avatar
  • 200k
Best practices
0 votes
7 replies
141 views

MySQL Eloquent ORM - where clause: value could be null

I'm a bit unsure about how to proceed with Eloquent ORM (Laravel 12) queries when a value COULD be NULL. Normally, you would check for a NULL value with: ->whereNull("column") But if you ...
MaxWeb's user avatar
  • 169
Answer

You could always do if ($value === null) { $query->whereNull('column'); } else { $query->where('column', $value); } (as Gemini suggests), but then you're doing what the Framework is already ...

View answer
Tim Lewis's user avatar
  • 29.5k
2 votes
2 answers
173 views

How to change the title of the billing field?in Woocommerce

I found some old code here to change the name of my 'Deliver to different address?' title in Woocommerce. Works perfectly... but I also want to change the name of my Billing Details title, to Billing ...
Elton's user avatar
  • 21
Answer

You can do this add_filter( 'gettext', 'change_billing_title', 20, 3 ); function change_billing_title( $translated, $text, $domain ) { if ( $domain === 'woocommerce' ) { if ( $text == '...

View answer
Abdulla Nilam's user avatar
1 vote
1 answer
119 views

Why does Laravel read the schema as if it had 2 primary keys? [duplicate]

Here's my laravel composer.json for its version info: { "name": "laravel/laravel", "type": "project", "description": "The skeleton ...
Evan Fersadi's user avatar
Answer

The error is in $table->integer('class_level', 3); Syntax integer($column, $autoIncrement = false, $unsigned = false) You can use unsignedTinyInteger() integer() FYK. (In future, hels you debug) ...

View answer
Abdulla Nilam's user avatar
Advice
0 votes
5 replies
128 views

Deploy Laravel version 12 (PHP, Inertia, ReactJS, Tailwind) to cPanel shared with no SSH Access

I have Laravel 12 project (PHP, Inertia, ReactJS and Tailwind) project that I need to deploy to a cPanel shared server. I do not have SSH access to the server, and the service provider does not give ...
Rootsman's user avatar
Answer

Sorry you'll have to bear with me as I'm not a Laravel expert, but are you absolutely sure you need to run those in the live environment - you can't just deploy ready-made files and database and run ...

View answer
ADyson's user avatar
  • 63.1k
8 votes
1 answer
1k views

`docker-php-ext-install opcache` works with PHP 8.4 but not PHP 8.5 [closed]

I can build an image with this Dockerfile that is based on a lightweight Docker image that use Alpine: FROM php:8.4.15-cli-alpine RUN docker-php-ext-install opcache But I can’t build an image after ...
A.L's user avatar
  • 10.7k
Answer Accepted

As documented in the PHP 8.5 changelog, since PHP 8.5 the Opcache extension now always ships with PHP (non-optional). So you don't need to install it any longer. Opcache: Make OPcache non-optional (...

View answer
hakre's user avatar
  • 200k
-1 votes
1 answer
95 views

Problem with module during dolibarr update [closed]

I tried to update dolibarr from 16.0.3 up to the current version 20.0.2. So far it succeeded, but I do have an error code when I want to use a custom module for time-tracking. To me it seems that ...
tehomas's user avatar
  • 11
Answer

You have upgraded to the wrong version. The 20.0.2 release is an update for the 20.0 branch. But you are coming from the 16.0.3 version, so the 16.0 branch. Please follow the upgrade instructions for ...

View answer
hakre's user avatar
  • 200k
2 votes
1 answer
112 views

Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works)

Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works) I'm working on a Symfony 7.3 project running on PHP 8.2. I recently migrated the database from ...
Juergen Schulze's user avatar
Answer

What you call out as a // Temporary Fix #[ORM\Table(name: '`user`')] actually is making use of the correct form to tell the Object Relational Mapper (ORM) what the actual name is. As user is a ...

View answer
hakre's user avatar
  • 200k
Best practices
0 votes
11 replies
6k views

How does a recursive function work in PHP?

Edit: How does this recursive call play out, why is i = 1, even though the function fires 3 times ? Doesn't the function reach the if statement -> fires -> (this repeats 3 times) then reaches ...
RDU's user avatar
  • 1,131
Answer

hasn't $i been incremented 3 times by that point ...yes, but it gets incremented within the scope of each individual call to the function - and then thrown away, because (aside from the echo rec($obj)...

View answer
ADyson's user avatar
  • 63.1k
Advice
0 votes
3 replies
122 views

Symfony monolog add additional info to all logs

I need to add trackability information for all logs. E.g. logged in user and route parameters (entity ID) Right now I have this code: use Monolog\Processor\ProcessorInterface; class RequestProcessor ...
Justinas's user avatar
  • 43.9k
Answer

Problem is that some logs (e.g. deprecations) are logged before Kernel::request event. That means there is no "current request" in strack. Sure, but as that will ever be you need something ...

View answer
hakre's user avatar
  • 200k
Advice
2 votes
7 replies
122 views

Splitting SQL output evenly into 3 HTML columns

I am trying to take the output of a SQL query and split it evenly into 3 HTML columns such as flexbox divs. Obviously the output total won't always be evenly divisible by 3 and the first 2 totals ...
Larry Moss's user avatar
Answer

Some sample data and expected result would go a long way to making your question clearer. And yeah this would have been better posted on the main troubleshooting posts rather than advice, I think. ...

View answer
ADyson's user avatar
  • 63.1k
-4 votes
2 answers
184 views

malformed uuid format sql server on mac

I get this error: "message": "Malformed UTF-8 characters, possibly incorrectly encoded", This is my real id with UUID in the database: 944CC79D-5980-4587-8A52-000A2F11D7D1 ...
Fajar Alam's user avatar
Answer

First of all it is very essential to know that you actually have the uniqueidentifier 16-byte column type and that the Relational Data Base Management System (RDBMS) is Microsoft SQL Server. Let's ...

View answer
hakre's user avatar
  • 200k
Advice
0 votes
3 replies
78 views

(WordPress) Execute SQL query in a specific product purchase

I would like to execute an SQL query after a specific product being purchased. Is there a solution to that? It’s about a "Tokens" currency that people can use in my software, but first you ...
user1337's user avatar
Answer

Presumably there is some part of the code which handles purchases. Maybe it even has events or hooks you can subscribe to. Either way, find that bit of code and add a function there to run your SQL ...

View answer
ADyson's user avatar
  • 63.1k
3 votes
1 answer
91 views

Laravel Service Container: Am I doing the right thing?

I have an invokable action class called: AttachMembersToRoom . Now, aside from basic form request validations, I also have complex validation, like comparing values across members, identify ...
ssrsvn's user avatar
  • 33
Answer Accepted

At this point, I'm not even sure if I'm doing the right thing, or am I even overcomplicating things? That depends. In your original design, both the array of class constants and their app-factory ...

View answer
hakre's user avatar
  • 200k
0 votes
1 answer
120 views

WordPress + Rootless Docker File/Directory Permission Issue

I’m running a WordPress site (https://example.com) behind Traefik on a VPS using rootless Docker (Docker daemon socket is /run/user/1000/docker.sock). Everything works fine except updating plugins ...
M. Safari's user avatar
  • 319
Answer

In particular, is there a recommended pattern for WordPress + rootless Docker (named volumes vs bind mounts, which user should own /var/www/html, etc.) that avoids these “Destination directory not ...

View answer
hakre's user avatar
  • 200k
2 votes
1 answer
411 views

Session ini settings cannot be changed after headers have already been sent in wp-config.php

I’m getting a fatal PHP error from my shutdown function on my WordPress site hosted on OVH: PHP Fatal Error: ini_set(): Session ini settings cannot be changed after headers have already been sent in /...
Jakub Hopciaś's user avatar
Answer

Just the PHP 101 here explained by the error message in context: PHP Fatal Error: ini_set(): Session ini settings cannot be changed after headers have already been sent in /home/moonlighok/www/wp-...

View answer
hakre's user avatar
  • 200k
1 vote
1 answer
165 views

Filament PHP: Memory exhausted when selecting all table records (500k+ rows) - How to limit or optimize?

I'm using Filament PHP v3 with Laravel and have a table that can contain 500,000+ user records. When users click the "Select All" button the application crashes with a memory exhausted error:...
Nguyễn Trọng Hiếu's user avatar
Answer

For your warning needs there is the ->count() method For your limit needs there is the ->take() method Exemplary Pseudo Code: $limitInclusive = 150_000; ... ->action(...

View answer
hakre's user avatar
  • 200k
Advice
0 votes
4 replies
123 views

Which language you should learn for Hybrid or Web view app?

I come from web development background and want to learn mobile app development. I have good experience in PHP, Mysql, HTML, CSS and less in JavaScript and Ajax. I prefer procedural PHP code due to ...
user28757434's user avatar
Answer

Which language you should learn for Hybrid or Web view app? One that works for you and you are comfortable to program with. Which language is simple like procedural code for Hybrid or Web view app? ...

View answer
hakre's user avatar
  • 200k
1 vote
1 answer
120 views

WooCommerce voucher PDF sometimes not sent after payment — Dompdf process silently fails after render

I have a custom WooCommerce plugin that generates a PDF voucher and sends it to the customer after payment. Most of the time it works perfectly, but occasionally, the email is not sent and no errors ...
Jakub Hopciaś's user avatar
Answer

Your Apache logs show a couple of "well known" Apache FastCGI error codes (AH10157 / AH10149) that are typical for crashing PHP scripts, common when WordPress consumes too much memory or ...

View answer
hakre's user avatar
  • 200k
-5 votes
2 answers
151 views

Text file with JSON data became corrupted

This is my code $serverGuestFile = fopen($_SERVER['DOCUMENT_ROOT'] . '/server/guest.txt', "r"); $serverGuestFileData = fread($serverGuestFile,filesize($_SERVER['DOCUMENT_ROOT'] . '/server/...
Hahanap's user avatar
Answer

You can't have your cake and eat it The file is read and written at different times, if not several times simultaneously. That the file is written in that way (per your code), is the only reason that ...

View answer
hakre's user avatar
  • 200k
4 votes
3 answers
405 views

PHP 8.4 rounding gives different result than 8.2

I am in the process of upgrading our code from php 8.2 to 8.4 I noticed we are getting some test failures because of round() returning different values than expected. Ultimately the problem could be ...
yeaitsme's user avatar
  • 129
Answer

This was a long standing regression introduced with PHP 5.2.7. PHP 4 and 5 versions prior to it rounded to 255. PHP version 8.4 has finally fixed the round() return value float. Better late than never ...

View answer
hakre's user avatar
  • 200k
Advice
2 votes
4 replies
139 views

How do you use set() on PHP arrays?

When using setters/getters on arrays, does your set() override the entire array or just the key? What is the accepted or best practice for this? Would you use set() for something like this or would ...
germanshedder's user avatar
Answer

When using setters/getters on arrays, does your set() override the entire array or just the key? What is the accepted or best practice for this? If you're looking for arrays with add or set, there is ...

View answer
hakre's user avatar
  • 200k
4 votes
3 answers
172 views

Connecting to Excel from PHP using PDO

I am connecting to an Excel file from PHP via PDO. When executing a query, Excel returns data, but it defines the first row of results as column names. How do I make Excel return all rows, including ...
Виктор Виктор's user avatar
Answer

In ODBC the first row is treated as column headers or data depends on the HDR setting. HDR=NO, which is correct. in newer versions of the Excel ODBC driver may still infer headers based on the data ...

View answer
Abdulla Nilam's user avatar


15 30 50 per page
1
2 3 4 5
47