Search the Community

Showing results for tags 'count'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH


  • Community Calendar




Website URL








Found 10 results

  1. <?php if (empty($count)) { $count=''; } if ($count == '') { $count ='1'; } else { $count++ ; } echo $count; echo '<br>'; ?> My goal is to make a script that increments $count ever time someone downloads the page. Can this be done without 'storing' the $count value? Or should I create a script with fwrite/fopen or $_SESSION?
  2. Hi, I have an issue and hope someone can point me in the right direction. I have a table called production Table production Id Job Company Status — —— ——— ——— 123 001 Test 1 Active 123 002 Test 1 Active 123 003 Test 1 Active 123 004 Test 1 Complete 123 005 Test 1 Active 123 006 Test 1 Complete 456 001 Test 2 Complete 456 002 Test 2 Complete 456 003 Test 2 Active 456 004 Test 2 Complete 456 005 Test 2 Active 456 006 Test 2 Complete 789 001 Test 3 Complete 789 002 Test 3 Active 789 003 Test 3 Active 789 004 Test 3 Active 789 005 Test 3 Active 789 006 Test 3 Active I'm trying to run a query that returns the following Company Active Complete Test 1 4 2 Test 2 2 4 Test 3 5 1 So its DISTINCT Id and counting the different status and return as above Any help would be great as I have been trying most of the day but without success Cheers Chris
  3. hi, sorry, i have a question to do...but i know how to write in sql query ....however the answer need to write on relational algebra in query is like : SELECT * FROM operation where r='broken' group by pc having count(pc) >1 ; π id,pc,result ( σ r = 'broken' (operation)) like group by and having clasue...i no idea ... i searched on internet still @@ .... isnt the answer like that, i using split/step by step method to do rel 1 = σ r = 'broken' (operation) rel 2 = σ count(pc)>1 γ pc,count(pc) (rel 1)) rel 3 = π id,pc,result (rel 2 ) thanks
  4. id | mid | pid | owgh | nwgh |1 3 12 1.5 0.62 3 12 1.5 0.33 3 14 0.6 0.44 3 15 1.2 1.15 4 16 1.5 1.06 4 17 2.4 1.27 3 19 3.0 1.4 Select mid , COUNT(distinct pid) as cpid , SUM(nwgh) as totalnwgh from test GROUP BY mid sqlfiddle : link of below result with above query mid cpid totalnwgh3 4 3.84 2 2.2 But above i need one more column that's as below : **totowgh** mid cpid totalnwgh totowgh3 4 3.8 6.3 (DISTINCT value as per pid column)4 2 2.2 3.9 where totowgh = 6.3 come by DISTINCT value as per pid columnthat's mid = 3 has count 5 but distinct pid = 4 for mid=3 same way "distinct" owgh = 6.3 for mid=3 and distinct pid.As pid=12 is count 1 time hence,1.5 + 0.6 + 1.2 + 3 = 6.3 ( please not this is as per DISTINCT value of pid )Please note : i need owgh value as per distinct pid or group by pid .. because if i replace value of owgh 0.6 with 1.5 then it will be 5.7 instead of 7.2 but value of owgh 0.6 belong to pid = 14 and not pid = 12 hence totalcount of owgh change ...but i need is 7.2SEE WHAT I MEANS :!9/2a53c/6
  5. I have a mySQL posts table, a files table, and a relationships table. I need to sum file download counts grouped by the post the files are associated with., p.post_title, count(d.download_id) FROM posts p INNER JOIN file_log d ON = d.file_idgroup by p.post_title The above query works as long as the titles of the files are the same, which is not always the case. I really need to group them by their relationship to the post they are associated with. The relationships are stored in relationships r, which shows r.post_id (which is from posts), and r.file_id (which is d.file_id from file_log) I have tried a few subqueries, but I am not sure how to join the relationships table to my query and group counts by r.post_id Thanks for any help.
  6. Here is my xml: <?xml version='1.0' encoding='UTF-8'?><wd:Report_Data xmlns:wd=""> <wd:Report_Entry> <wd:field>1111</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>2222</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>3333</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>2222</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>3333</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>1111</wd:field> </wd:Report_Entry></wd:Report_Data> Here is the xslt I am using: <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:wd="" xmlns:xsl=""version="2.0"><xsl:strip-space elements="*"/><xsl:output indent="no" method="text" /> <xsl:key name="entry" match="wd:Report_Entry" use="wd:field" /> <xsl:template match="wd:Report_Data"> <xsl:value-of select="count(wd:Report_Entry | wd:field[ generate-id() = generate-id(key('entry', wd:field))])"/> </xsl:template> </xsl:stylesheet> I am trying to count the unique values. So in the example above, the answer should be 3 and I am getting 6. I can get this to work in 1.0 with the following code: <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:wd="" xmlns:xsl=""version="1.0"><xsl:strip-space elements="*"/><xsl:output indent="no" method="text" /> <xsl:key name="entry" match="wd:Report_Entry" use="wd:field" /> <xsl:template match="wd:Report_Data"> <xsl:value-of select="count(wd:Report_Entry [ generate-id() = generate-id(key('entry', wd:field))])"/> </xsl:template> </xsl:stylesheet> But I can't use 1.0 I have to use 2.0. Is there any way to get this to work in 2.0 or am I just out of luck? Any help would greatly be appreciated! Thanks,Sarah
  7. I am trying to create an xref and cannot get the correct step number in the reference. I am pointing at the cmd tag because when I point at the step tag, it does not link to a page number. The below code (second set) counts all the preceding cmd tags in the whole document. Is there a way to count only the cmd tags in the current task/topic? I have tried creating variables (shown directly below), and this gets me to the correct task number in the document. From there, I could not get it to count the preceding cmd tags in the task in the CurrTask position. Any help on this is greatly appreciated. <xsl:variable name="Tasks" select="count(preceding::*[contains(@class, ' task/steps ')])" /> <xsl:variable name="CurrTask" select="$Tasks +1" /> <xsl:template match="*[contains(@class, ' task/cmd ')]" mode="retrieveReferenceTitle"><xsl:call-template name="insertVariable"> <xsl:with-param name="theVariableID" select="'Step'"/> <xsl:with-param name="theParameters"> <number> <xsl:value-of select="count(preceding::*[contains(@class, ' task/cmd ')]) + 1"/></number></xsl:with-param> </xsl:call-template> </xsl:template> Alternatively, when I point the xref at the step, and insert <fo:inline id="{@id}"/> and <xsl:call-template name="insertPageNumberCitation"/> at the end of the template, it gives me the page number of the actual xref, not the page number of the step it is pointing at. Thank you.
  8. I have a table of orders. Each order has a status, one being "Shipped". The end goal is to take the data and push it into a chart showing total orders, shipped orders, and grouped by month/year. I can get the count of the orders and group them by month/year, but I'm not sure how to also include orders with the status of "Shipped". Any ideas? (The code I have now is counting the orders into a column called Orders and Shipped, but I know it's not actually grabbing shipped orders for the Shipped column. I just have it there for now so I could move on with populating a chart while I work on fixing the query.) SELECT COUNT(o.ROW_ID) AS Orders, COUNT(o2.ROW_ID) AS Shipped, RIGHT(CONVERT(VARCHAR(8), o.STATUS_DT, 3), 5) AS Date, MONTH(o.STATUS_DT) AS Month, YEAR(o.STATUS_DT) AS YearFROM dbo.S_ORDER AS o LEFT OUTER JOIN dbo.S_ORDER AS o2 ON o.ROW_ID = o2.ROW_IDWHERE (o.CREATED > CONVERT(DATETIME, '2011-04-01 00:00:00', 102)) AND (o.CREATED < CONVERT(DATETIME, '2012-05-1 00:00:00', 102))GROUP BY RIGHT(CONVERT(VARCHAR(8), o.STATUS_DT, 3), 5), MONTH(o.STATUS_DT), YEAR(o.STATUS_DT)ORDER BY Year, Month, Date DESC
  9. Hey Everyone, I am fairly new to SQL and pulling out whatever little hair is left on my head. I have a data dump where we are trying count the "First Call Resolution" for tickets that an employee opens and closes himself. The company is using MS Access and I am working with a basic data dump from the ticketing system. I have already weeded out everything I don't need, but I'm having trouble trying to compare and count two rows in the same table. Here is an example of the info in the table ticket_number | agentID | activity | notesGLOB-1234 | tier1_A1 | OPENS | ticket openedy by tier1_A1 - BobGLOB-1234 | tier1_A1 | REMRK | helped client fix their stuffGLOB-1234 | tier1_A1 | CLOSE | ticket closed by tier1_A1 - BobGLOB-1235 | tier1_A2 | OPENS | ticket openedy by tier1_A1 - Chris GLOB-1235 | tier1_A2 | REMRK | Could not resolve issue, routing to tier 2GLOB-1234 | tier2_A2 | REMRK | Recevied ticket from tier1, fixed problem remotely, advised clientGLOB-1234 | tier2_B1 | CLOSE | ticket closed by tier2_A2 - Mike I want to be able to check the table to see how many ticket tier1 agents have resolved on their own. In order to do this, I just have to count the number of times that I have a row where ticket_number, agentID are the same, and where Activity = 'open' and activity = 'close'. I want to make the solution simple and elegant and try and do it within the same table. I guess one other option would be to create two separate views a then compare the two tables to each other? Please help me!!!Thanks in advance
  10. I've been at this for a couple of days now so I can really say i have no idea. Im making a temporary parking pass kiosk. Users will enter their information and get a pass that matches that. Everything works except for trying to count how many passes they have gotten. I have been trying to do it this one way, and the fact i cant get past an error code tells me im doing it wrong. So i was wondering if anyone had any ideas on how i could start this. Ill post my code below to show you. //add user plate to table $stmt = $conn->prepare("INSERT INTO count(plate) values(?)");$stmt->bind_param("s", $plate);$stmt->execute();$stmt->close();$sql="SELECT * FROM count where plate =$plate";$result=mysqli_query($conn,$sql);$row=mysqli_fetch_row($result);$counter=$row['counter'];// if have no limit value set counter = 1if(empty($counter)){$counter=1;$stmt = $conn->prepare("INSERT INTO count(limit) values(?)");$stmt->bind_param("s", $counter); $stmt->execute(); $stmt->close();} //If limit is over three redirect to error pageelseif($counter > 3) {header("Location: error.html");}else{// add one more to limit$addcounter=$counter+1;$stmt3 = $conn->prepare("Update limit SET count =? where plate = $plate"); $stmt3->bind_param("s", $addcounter); $stmt3->execute(); $stmt3->close();} What i am trying to have happen is when the primary key is entered 'plate' it will add to the table "count". Along with adding that plate number, i want the 'limit' attribute to go up by one. Once user hit a maximum of three passes they will be given an error message and asked to see the attendant. Right now it tells me that nothing is attached to the attribute $plate, which i know is untrue because that variable is called upon at a different part of my script and that part works. Any ideas? Where am i going wrong.