php - pdo get number of rows -


i trying number of rows using pdo , if number less 1 echo not found else other stuff. below code isn't displaying "not found" if there no results matching clause.

$options = array( 'results_per_page'              => 200, 'url'                           => 'index.php?page=*var*', 'db_handle'                     => $dbh );   $page = $_get['page'];  $paginate = new pagination($page, 'select * pants size ="medium" or size ="m"  order id desc', $options); $result = $paginate->resultset->fetchall(); if($result > 0)         {  foreach($result $row) { echo $row['title'];}  else {   echo "not found";} 

you cannot compare array number, mind (yeah, in php).

to test if have in array, simple

if($result) 

is enough.

note problem has nothing getting number of rows. need know if have any rows, not count them.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -