Re: [PHP-DB] Navigation Help
[email protected] (Chris)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
> $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/