0
Good night,
As use, I do to count the amount of results of a select in the database using PDO?
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type,x-prototype-version,x- requested-with');
include_once("conPDO.php");
$pdo = conectar();
$data = file_get_contents("php://input");
$data = json_decode($data);
$email = $data->email;
$senha = $data->senha;
$login=$pdo->prepare("SELECT * FROM usuarios WHERE email=:email AND senha=:senha");
$login->bindValue("email", $email);
$login->bindValue("senha", $senha);
$login->execute();
$count = $login->fetch(PDO::FETCH_NUM);
print_r($count);
try $nRows = $Pdo->query('select Count(*) from blah')->fetchColumn(); echo $nRows;
– Fbor