Re: Navigation Help

From: Date: Thu, 05 Jun 2008 01:34:40 +0000
Subject: Re: Navigation Help
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-45043@lists.php.net to get a copy of this message
> $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/

« previous php.db (#45043) next »