columncount : Number of Columns Present in the query

PHP PDO & MYsQL By using PDO MySQL function columncount() we can get number of columns present in the query.

Here is the code to get total field numbers present in the table
<?Php
require "config.php"; // Database connection string

$count=$dbo->prepare("select * from pdo_admin ");
$count->execute();
echo "Number of Columns : ". $count->columnCount();
?>
The output will be
Number of Columns : 5
Query can be changed like this
$count=$dbo->prepare("select id,userid from pdo_admin ");
The output will be
Number of Columns : 2


Visitors Rating
Your Rating





Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer