count
| From: | Barry Rumsey | Date: | Thu, 10 Jan 2002 13:05:48 +0000 |
| Subject: | count | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15595@lists.php.net to get a copy of this message | ||
I'm trying to do the following query:
$db_connect = mysql_connect($sqlhostname,$login,$password);
$base_selection = mysql_select_db($base,$db_connect);
$query = "SELECT DISTINCT * FROM xp_topics WHERE artist_count='artist' AND topictext
LIKE
'A%' ORDER BY artist_count ASC limit 0,5"; $req = mysql_query($query);
$res = mysql_num_rows($req); if ($res == 0)
{ echo "</p>
<p><b>N/A</b>";} else { while($row = mysql_fetch_array($req))
$query2 = "SELECT SUM(1) FROM xp_stories,xp_topics WHERE xp_topics.topicid = xp_stories_topicid
AND xp_topics.topictext = '$topictest'";
$numtopic = mysql_query($query2) or die("Select Failed!");
$numtopic = mysql_fetch_array($numtopic);
{ extract($row); echo ("$topictext $numtopic[0]<br>
"); } }
?>
Which should return a name and then count how many topics by that person.
If I leave out the query2 statement I do get a list of name, but I can't get query2 to work.