SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Select count id and then select another column

    I'm trying to count id's of a certain query but I need also to select another column.

    I have the code below, but its not working.

    Code:
    <div id="other-Reports-This-Month">
    <? $a=mysql_query("select x.countt, DateOccured from hazzard, (select count(UniqueIdentifier) as countt FROM hazzard) where WHERE MONTH(DateOccured) = ".date('m')." AND YEAR(DateOccured) = ".date('Y')." AND seenByManager=0");
    
    $data=mysql_fetch_assoc($a);
    //echo $data['total1'];
    ?>
    <p><strong>Other Reports This Month: <span style="font-size:14px; font-weight:normal; vertical-align:2px; color:#71A6D4">[<? echo $data['countt'] ?>]</span></strong></p>
    </div>
    I think in honesty, I've got myself all twisted up as what I need is to draw out the number of id's that are in this month only and seenByManager=0

  2. #2
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I should have posted sorry where I started off from as that maybe easier if I have gone way off mark.

    Code:
    <? $a=mysql_query("select count(UniqueIdentifier) as total1 from hazzard WHERE MONTH(DateOccured) = ".date('m')." AND YEAR(DateOccured) = ".date('Y')." AND seenByManager=0");
    $data=mysql_fetch_assoc($a);
    //echo $data['total1'];
    ?>
    Oh hang on that seems to be working now, I may have done something to fix it.

    If its wrong could someone correct me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •