PHP and use of the Num_Of_Rows() function?
- by Michael Smith
Below is some PHP code that i have written, the problem occurs when it gets to the use of the num_of_rows(), it just does not seem to work and i cant figure out why?
<?php
try
{
$divMon_ID = array();
$divMon_Position = array();
$divMon_Width = array();
$divMon_Div = array();
$db = new PDO('sqlite:db/EVENTS.sqlite');
$result_mon = $db->query('SELECT * FROM Monday');
$totalRows = mysql_num_rows($result_mon);
//for($counter=1; $counter<=10; $counter+=1)
//{
//<div id="event_1" style="position:absolute; left: 0px; top:-39px; width:100px; font-family:Arial, Helvetica, sans-serif; font-size:small; border:2px blue solid; height:93px">
//$divMon_ID[]=$row['Id'];
//$divMon_Position[]=$row['Origin'];
//$divMon_P[]=$row['Position'];
//}
}
catch(PDOException $e)
{
print 'Exception : '.$e->getMessage();
}
?
I know that it is the "$totalRows = mysql_num_rows($result_mon);" statement because when i then comment it out, the page can load.
Am i using the function in the wrong way?
Thanks.