Re: Navigation Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  $result = safe_query("select count(*) FROM gig g, venue v WHERE g.gigName LIKE '%".$gig_name."%' ");
>  $noEntries = mysql_num_rows($result);
>  $noPages = ceil($noEntries / $limit);

$noEntries is always going to be 1 - there is a single row with the
'count' in it.

What you probably want is:

$result = safe_query('select count(*) AS count from ... ....');
$noEntries = mysql_fetch_assoc($result['count']);

or

// since we're not 'aliasing' the result, i dont know what it will be
called in the $row array.
// so just pop it.

$result = safe_query("select count(*) from ...";
$row = mysql_fetch_assoc($result);
$noEntries = array_pop($row);

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux