PHP and use of the Num_Of_Rows() function?

Posted by Michael Smith on Stack Overflow See other posts from Stack Overflow or by Michael Smith
Published on 2010-05-16T17:00:44Z Indexed on 2010/05/16 17:10 UTC
Read the original article Hit count: 107

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about sqlite