RewCount (): Returns the number of rows affected:
$sql='select * from '.$_POST['fname'].'_blog_data';
$sth=$pdo->query($sql);
die('<script>alert('.$sth->rowCount().')</script>');
2
$q = $pdo->query("SELECT count(*) from w_login_record;"); $rows = $q->fetch(); $rowCount = $rows[0];
die('alter("'.$rowCount.'")');
3
Use the fetchAll function $q = $db->query("SELECT ..."); $rows = $q->fetchAll(); $rowCount = count($rows);
Read More:
- Leetcode 357: How to calculate the number of digits with different digits
- [Solved] PHP Error: Warning: file_get_contents(): Failed to enable crypto
- PHP Error Object of class mysqli could not be converted to string in
- [Solved] WordPress Upgrade PHP 5.6 to 7.x Fatal error: Uncaught Error: Call to undefined function mysql_connect()
- PHP: How to parse MHT file into HTML
- PHP curl error: SSL certificate problem: unable to get local issuer certificate settlement program
- How to Hide index.php
- php_network_getaddresses: getaddrinfo failed (How to Fix)
- How to Solve PHP Fatal error: Namespace declaration statement has to be the very first statement
- How to Solve PHP Error: no package’oniguruma’ found
- PHP error in Windows: class’ mysqli ‘not found
- [PHP] Array to string conversion error when sending data in post
- Error during session start; please check your PHP and/or webserver log file and configure your PHP
- PHP php-config is not installed error in ubuntu 16 [How to Solve]
- Using $this when not in object context in (How to Fix)
- php Error: mail() Failed to connect to mailserver at “localhost” port 25
- [PHP]json_encode Chinese JSON_UNESCAPED_UNICODE returns null in php5.3
- [PHP] Solve the limitation of uploading files in nginx php 413 Request Entity Too Large
- [Solved] PHP Fatal error: Uncaught Error: Class ‘Redis‘ not found in
- [PHP] Solve PHP Call to undefined function ldap_connect()