> -----Original Message-----
> From: Stitchin' [mailto:[EMAIL PROTECTED]
> Subject: Count (*) function results needed in echo statement
>
>
> I've got the following code in my php file:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> /* Select all categories from designcatagories table */
> $query = "SELECT designcatagories.catcode, designcatagories.catdesc,
> count(*) FROM
> designs,designcatagories where designs.catcode =
> designcatagories.catcode
> GROUP BY catcode";
> $result = mysql_query($query)
> or die ("Couldn't execute query.");
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi Renee,
The easiest way to reference the output of mysql's functions in a meaningful
way inside php would be to use 'as field_name', so for example if you
changed your query to..
====================
$query = "SELECT designcatagories.catcode, designcatagories.catdesc,
count(*) as thiscount FROM
designs,designcatagories where designs.catcode =
designcatagories.catcode
GROUP BY catcode";
====================
..you could then simply reference the result of count() as thiscount in the
same way as you print catdesc, catcode et al currently.
HTH,
William.
> I tested it in phpMyAdmin and I'm getting the correct results
> .... here's my
> dilemma ... I want to spit out a list of my catcodes, # designs found,
> catdesc
> and I'm not sure how to reference the count(*) object??? What I have below
> doesn't work, it just prints the () and I can't find any reference to this
> in my books??? HELP!!!
>
> echo "><b>$catcode</b></font>
> </td>
> <td>$count()</td>
> <td>$catdesc</td>
> </tr>";
>
> Renee Toth
> Stitchin' Up A Storm
> www.stitchinupastorm.com
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php