Aug 20 2021 01:41 AM - edited Aug 20 2021 01:41 AM
Hello everyone,
I have a problem with the rowCount() in this code:
$sqlLoc= "DECLARE @Data2 AS DATE;
SET @Data2 = CONVERT(DATE,CONVERT(date, '$dataIncasso'), 102);
DECLARE @Data1 AS DATE;
SET @Data1 = DATEADD(DAY, $interval, @Data2)
SELECT noteincassi.CodLocale,Insegna,Citta
FROM [Edera].[dbo].[NoteIncassi],edera.dbo.AnagraficaLocali
where DataIncasso=@Data2 AND tipoincasso='6' and AnagraficaLocali.CodLocale=NoteIncassi.CodLocale AND sospeso=0
GROUP BY noteincassi.CodLocale,insegna,Citta
ORDER BY Insegna";
$queryLoc=$conn->prepare($sqlLoc,array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
//$queryLoc->execute();
if($queryLoc->execute()){
echo $numero=$queryLoc->rowCount();
}
$id=0;
while($resultLoc=$queryLoc->fetch()){
It will print -1 but the fecth is working and row are returned,so the rest of the code is working fine, it's only the rowcount and I don't understand why.
Thank you
Aug 25 2021 07:56 PM