Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7701497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:59:59+00:00 2026-05-31T22:59:59+00:00

I can’t seem to find this information in other questions, even though I think

  • 0

I can’t seem to find this information in other questions, even though I think it is a basic problem.

In mySQL, I’m attempting to COUNT the number of rows in column “rowid” from the one table that occurs in thousands of different schemas (therefore listing the schemas individually is impractical).

Note: some schemas do not have the table, and therefore no information.

Thanks!

Edit:

I attempted the script below and it kept returning:

Fatal error: Call to a member function execute() …

This was on the SECOND execute function. To fix this, I manually input the result of the first sql into the second variable sql but that gave me:

Fatal error: Call to a member function prepare() on a non-object in _____ on line 18 (aka the first prepare statement)

Here is the code. You’ll see I’ve been playing around with it a bunch (I used a different connect method to see if that changed anything)

<html>
<head>
</head>
<body>

<?php
$db = mysql_connect(localhost,******, *******);


$sql = "SELECT TABLE_SCHEMA, TABLE_NAME
        FROM INFORMATION_SCHEMA.COLUMNS
        WHERE TABLE_NAME = 'Ftrans /*this is our specific table name*/'
        AND COLUMN_NAME = 'rowid'";


$stmt = $db->prepare($sql); /*this is where I got the second error*/
$stmt->execute();

while ($row = $stmt->fetchObject()) {
   // $sql2 = "SELECT COUNT(*) FROM $row->TABLE_SCHEMA.$row->TABLE_NAME";


 $sql2 = "SELECT COUNT(*) FROM fp_AIRG.Ftransi";
    $stmt2 = $db->prepare($sql2);
    $stmt2->execute();
 $count = $stmt2->fetchColumn();
}
mysql_close($db);
?>

</body>
</html>
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:00:01+00:00Added an answer on May 31, 2026 at 11:00 pm
    SELECT TABLE_SCHEMA, TABLE_NAME
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_NAME = 'tbl_name'
    AND COLUMN_NAME = 'rowid'
    

    Then for each record returned –

    SELECT COUNT(rowid)
    FROM {TABLE_SCHEMA}.{TABLE_NAME}
    

    Here is a PHP based implementation –

    <?php
    
    try {
        $db = new PDO('mysql:dbname=testdb;host=127.0.0.1', 'username', 'password');
    } catch (PDOException $e) {
        echo 'Connection failed: ' . $e->getMessage();
    }
    
    $sql = "SELECT TABLE_SCHEMA, TABLE_NAME
            FROM INFORMATION_SCHEMA.COLUMNS
            WHERE TABLE_NAME = 'tbl_name'
            AND COLUMN_NAME = 'rowid'";
    
    $stmt = $db->prepare($sql);
    $stmt->execute();
    
    while ($row = $stmt->fetchObject()) {
        $sql = "SELECT COUNT(rowid) FROM `{$row->TABLE_SCHEMA}`.`{$row->TABLE_NAME}`";
        $stmt2 = $db->prepare($sql);
        $stmt2->execute();
        $count = $stmt2->fetchColumn();
    
        echo "{$row->TABLE_SCHEMA}.{$row->TABLE_NAME}: $count\n";
    }
    

    I have not run this so it may have some errors in it but it should get you heading in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can find why i get this error can someone help? package Android.data; public class
Can anyone help me trying to find out why this doesn't work. The brushes
Can anyone explain to me why this program: for(float i = -1; i <
Can someone maybe tell me why this is not working? I have used echo
Can anybody tell me a regular expression to use within some PHP to find
Can I have a project that has some parts written in c and other
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
can someone explain what means this line, or provide with source where it is
Can someone please explain how this code is working for me? I don't understand
Can I write this with less code, also is .click(function preferred for mobile or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.