PDOStatement::columnCount

(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)

PDOStatement::columnCount Returns the number of columns in the result set

Beschreibung

public PDOStatement::columnCount(): int

Use PDOStatement::columnCount() to return the number of columns in the result set represented by the PDOStatement object.

If the PDOStatement object was returned from PDO::query(), the column count is immediately available.

If the PDOStatement object was returned from PDO::prepare(), an accurate column count will not be available until you invoke PDOStatement::execute().

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Returns the number of columns in the result set represented by the PDOStatement object, even if the result set is empty. If there is no result set, PDOStatement::columnCount() returns 0.

Beispiele

Beispiel #1 Counting columns

This example demonstrates how PDOStatement::columnCount() operates with and without a result set.

<?php
$dbh 
= new PDO('odbc:sample''db2inst1''ibmdb2');

$sth $dbh->prepare("SELECT name, colour FROM fruit");

/* Count the number of columns in the (non-existent) result set */
$colcount $sth->columnCount();
print(
"Before execute(), result set has $colcount columns (should be 0)\n");

$sth->execute();

/* Count the number of columns in the result set */
$colcount $sth->columnCount();
print(
"After execute(), result set has $colcount columns (should be 2)\n");

?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Before execute(), result set has 0 columns (should be 0)
After execute(), result set has 2 columns (should be 2)

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Auto sell dumps : dumps201.net/ Sell 24/7 ONLINE Dumps-Fullz-cvv

(+ dumps201.net +) supports Cashapp, PayPal, and bank transfers.welcome to Dumps Ccv Shop (+ dumps201.net+) Sells Cashapp, PayPal card cloning PIN ...

Geschrieben von sellergood11 am 13.06.2026 05:26:04
Forum: Existenzgründer, Freelancing, Verträge und sonstiges
dumps201.net/Dumps Shop 2026 Dumps Shop 101/201 Buy CC Online 2026Best Dumps Shop

Trusted CCV Shop - Valid CCV Online 2026 | Dumps With Pin - Legit Dumps Shop | E-Gift Card - Clone Card Shop -------------- CCV Shop Welcome Cust ...

Geschrieben von sellergood11 am 13.06.2026 05:24:53
Forum: Jobgesuche
dumps201.net/CVV Shop buy CVV Dumps, CC Fullz Info, Cloned Cards Dumps ATM

Trusted CCV Shop - Valid CCV Online 2026 | Dumps With Pin - Legit Dumps Shop | E-Gift Card - Clone Card Shop -------------- CCV Shop Welcome Cust ...

Geschrieben von sellergood11 am 13.06.2026 05:24:09
Forum: User pages
dumps201.net>Shop info FULLZ MMN,SSN/DOB/DL/CS/CR/BG etc), PROs + Photo DL

BEST DUMPS SHOP 2026 | DUMPS FRESH TRACK 1&2 | dumps201.net | DUMPS SHOP | CC SHOP | BANK LOGIN | CLONING CARD 2026 | ATM DUMPS PIN | CHIP CARD 20 ...

Geschrieben von sellergood11 am 13.06.2026 05:23:24
Forum: Provider / Domains