Hi all i . I got a php page that i want to run multiple queries in it but one of my query does not work. The first query is working fine but not the second one. I use <? echo $result2; ?> to output the second query result but i keep getting Resource id #4 instead of number of all albums in db!!
Could any one help me fix this problem.Thanks
PHP Code:
$query = "select artist,count(distinct album),count(album)from musictest group by artist";
$result = mysql_query($query);
$query = "select count(distinct album) as albums from musictest";
$result2 = mysql_query($query);
$numbers=0;
while($row = mysql_fetch_assoc($result))
{
$numbers++; // counting number of records
?>
<tr>
<td align="middle"><? echo $numbers; ?></td>
<td><a
href="albums.php?albumname=<?=strval( $row['artist'] );?>"><font
size="2"
face="Arial, Helvetica, sans-serif"><b><?=strval( $row['artist'] );?></b></font></a><font size="2"
face="Arial, Helvetica, sans-serif"><b> </b></font></td>
<td align="middle"><?=strval( $row['count(distinct album)'] );?></td>
<td align="middle"><?=strval( $row['count(album)'] );?></td>
</tr>
<?
}
?>
<tr>
<td align="middle"> </td>
<td align="right"><b>Totals Albums</b></td>
[B] <td align="middle"><b><? echo $result2; ?></b></td> [/B]=>problem here <td align="middle"> </td>
</tr>
</TBODY> </table>




Reply With Quote