Count Down
I want to display countdown timer in H:m:s format. for this i am
using frames, top frame contains the timer, (autorefresh and the time
is updated), in the bellow frame, test qustions are there. On
reaching the target time, i want to redirect the whole page to a new
page or (which contains the message the time is over). How to do this?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1">
</head>
<frameset rows="80,*" frameborder="NO" border="0" framespacing="0">
<frame src="head.php" name="topFrame" scrolling="NO" noresize >
<frame src="body.php" name="mainFrame">
</frameset>
<noframes><body>
</body></noframes>
</html>
?>
...........
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Count()
I am getting an error message if I add another field in the Select statement beside Count().
Count Down
I want to display a countdown timer. For this i used frames, the top frame contains the time and the bottom frame contains the questions, the top frame refreshes (autorefresh every second), After reaching the target time, a new page has to be loaded (redirect to a new page, which contains the message test time is over). How to do this? The below code is not redirecting to the timeover page frame.php ....
How To Count Age?
How can I count the difference between two dates? ( I can't change them into Unix format using mktime(), because in my database are also people born before 1970). Are there any alternative functions?
Count & Max
I need to count the rows in a mysql table and to find the max value of a column. I am selecting count and max with mysql queries, but fail getting the results from my php code. For counting the rows I also tried mysql_fetch_array and then counting the rows in the array, but it didn't work either. Does someone know how to retreive the results of count() and max()?
PHP COUNT( )
the code pasted below works perfectly... however if i attempt to change the select to COUNT(id) and also change the echo line down below, I get errors ... Any ideas about how to modify the code for it to perform the count() function properly? Code:
Count
how to count the same data in field?
How To Count Max In SQL?
Maybe this isn't the most apropriate place to ask mysql related question, but I think it is close enought to most php users and I always got find answers on this group. well, I need to count how meny rows have some maximum number. here is exact situation (striped down table) (pictID, jpeg name, #of votes) pict1, name1.jpg, 4 pict2, name2.jpg, 22 pict3, name3.jpg, 5 .... pict7, name7.jpg, 8 pict8, name8.jpg, 22 pict9, name9.jpg, 9 so, I need query (or set of querys) which will give me back rows 2 and 8 (I know, rows 1 and 7, but for easyer description, please let forget for moment that first is 0) I know what to do if I have only one picture with maximum votes: SELECT * FROM picts ORDER BY votes DESC LIMIT 1 (maybe not the best solution, but is working). now, I wanted to count how meny rows have MAX of votes, but I was unable to do that with my knowlage... SELECT max(votes)... and than $TotalMax=mysql_num_rows($result); in any combination (list), (while(list(too(much...) only failures... at the end I wanted to do SELECT with LIMIT so I can drow only those wining pictures: $query1 = "THAT one I don't KNOW"; $result1 = mysql_query ($query1) or die ("Query failed..."); list($new_limit) = mysql_num_rows($result1); //and now: $query2 = "SELECT * FROM picts ORDER BY votes DESC LIMIT $new_limit"; $result2 = mysql_query ($query2) or die ("Query failed..."); list($pict_data1,$pict_data2,$pict_data3) = mysql_fetch_array($result2); can anyone help me with that 1st query? or anyone have easyer solution? oh yes, I can not tell how meny pictures will have maximum number of votes. so far (in 4 years of manual handling of my site) there vere only 3 moments with 2 pictures sharing wining position, never more... normaly just one.
Count Down
I want to display a countdown timer. For this i used frames, the top frame contains the time and the bottom frame contains the questions, the top frame refreshes (autorefresh every second), After reaching the target time, a new page has to be loaded (redirect to a new page, which contains the message test time is over). How to do this? The below code is not redirecting to the timeover page frame.php ....
Best Way To Count
I have a "views" field in my table for each record. Looks something like this: ID | Views ------------- 1 | 20 2 | 50 3 | 30 What is the best way to display: "Total Views: 100"
Count
I have a database of images each which gets it own number of hits. how do i then 'add ' all these hits together to get a total number of hits? SELECT *, COUNT(hits) FROM photos GROUP BY hits DESC LIMIT 5 is my attempt but i know its wrong
Mysql_num_rows() Vs. COUNT()
Does anyone know what is more efficient to count row numbers with? the mysql_num_rows() function on a query result or using the COUNT() function within a query. Anyone know?
SUM() And Count Problems
I'm having problems using sum() and count. I want to automatically display the top 10 photographers on my site and I want to sort them by total picture counts and picture hits. The code below will pick out 10 photographers and display their total pictures and total picture hits correctly but I can't get it to sort by picture counts or hits, the results are sorted alphabetically. How can I get the code below to sort by total pictures or total hits?
Help With Select Count In PHP
I'm trying to do a script that tells me how many orders I got in on a particular day. The script loads, but nothing shows up. Any help would be greatly appreciated! Here it is: <? //create connection $connection = mysql_connect (localhost, xxxxxx, xxxx) or die ("Couldn't connect to server."); // select database // substitute your own database name $db = mysql_select_db (MyDB, $connection) or die ("Couldn't select database."); $date = "02/05/02"; // create SQL statement $sql = "SELECT COUNT(*) FROM CUSTOMER as mycount WHERE CREATED='$date' AND STATUS=Ɔ'"; // execute SQL query and get result $sql_result = mysql_query($sql,$connection) or die ("Couldn't execute query."); //start results formatting echo "<br><br><div align=center>"; echo "<table cellpadding=5 cellspacing=0 width=ྛ%'>"; echo "<tr bgcolor='#336699'> <td width=100% valign=top><font face='verdana,arial,helvetica' size='-2' color='#ffffff'><b>Orders Today:</b></font></td> </tr>"; // format results by row while ($row = mysql_fetch_array($sql_result)) { $mycount = $row["mycount"]; echo "<tr> <td width=100% valign=top><font face='verdana,arial,helvetica' size='-2' color='#000000'>$mycount</font></td> </tr>"; } echo "</table>"; echo "</div>"; /free resources and close connection mysql_free_result($sql_result); mysql_close($connection); ?>
Multiple Count()
I was wondering what the most efficient way to perform multiple count queries is? Is there any tips you can give that will speed up the process? For instance, is is quicker to do count(*) or is it quicker to count a field that has the smallest amount of info? At the moment I am using a function to count 26 times, but it has slowed down the web page too much. What I need to count, is how many records there are for each letter of the alphabet.
Help With Mysql Count(*)
I've been tearing out my hair trying to get my latest project online. I have a user based site and some of the info is being stored in a mysql table where each record is identified by the user's username. I want to generate a list to be displayed online that shows the top ten users who have the most records. Basically just a list of the the most frequently occuring records in the table. Right now I am using the following SQL query: $sql = "SELECT user, COUNT(*) as number FROM tablename GROUP BY user ORDER by number desc LIMIT 10"; $result = @mysql_query($sql, $connection) or die("Couldn't Execute Query"); I'm getting data back but am not sure if it is correct or exactly how to display it on the page. I typically use: while ($row = mysql_fetch_array($result)) {} but am not sure how to extract the count for each record using this.
Count Session?
Is there a way to count the number of active sessions on a server? it would be nice to have something like: "Right now there are $sessioncount visitors in thís site"
PhP MySQL COUNT()
I just can't seem to find any reference of a query string, using two count statements. Any help would be appreciated. I need to count the records that have a good email and at the same time count the same records that have a bad email. Then display that result in table form, Grouped by com,net,org etc. I can get good or bad emails based on the query below but not both at the same time:
Character Count
i need to know how to count the number of characters in a variable. E.g. $a = "hello"; i want something to tell me how many letters are in $a.
Count Down To Date.
I have been working for the past few months on an AOL instant messenger profile enhancement website, similar to sub profile. I am almost completely done working on a photo gallery which I've done with help from posts on this board and others. But i searched and searched and could find nothing specific to my question. How do I make a countdown script? So say I have a profile on my website, and I want to show a countdown to my birthday. I enter the date in the member's area to when i want to count down to, we'll say my birthday for example (august 4th) Then when someone views my profile, they see this: Bouley86's Birthday: XX Months and XX Days What kind of information would I have to collect and insert into my DB in order for this to work and what would I compare it to in order to get the numbers and how would I have to compare it.
Word Count
I have a form which users can write a letter and outputs it as $letter - done this, but I need something to count the number of words written.
Count Array?
I wrote a counter script which counts each unique visitor, and counts how often a visitor has visited. The data is stored in a "counter.txt" file divided by "||". The lines in the file are constructed as follows: linenumber||ip-address||times-visited|| e.g. .... 43||34.913.657.901||53|| 44||436.422.67.78||5|| 45||346.465.3.436||27|| .... I count unique visitors by counting the number of lines, but how can i count the total of hits? So that means adding up the 3rd part of each line... (I've searched php.net, and tried some of the array functions but i can't figure it out.)
MySql Count
$arr = array ("A", "B", "C", "D", "E"); foreach ($arr as $client) { $count = mysql_query('SELECT COUNT(*) from table where columnA = $client'); echo "$client has $count"; echo '<br>' }
Day Of Year Count
I have a script that reports that day on which a post expires as: 2000-06-12. What i would like to do is post it instead as: Expires in: 11 Days. So basically, I'm looking for a PHP3 way to do a Day of year Subtraction. I know with MySQL its: (TO_DAYS(Expires) - TO_DAYS(Current_Date)) is there a way to do it without going back into MySQL, using PHP3? OR how to i configure my Select so that it will automatically output "Expires" date as a the day count UNTIL expires.
Using Mysql Count
I have the following query that works in mysql: select id, order_no, price, count(item_no), sum(price) from production WHERE item_no = ?' group by item_no; When I setup my query in php, I use: $query2 = "SELECT id, order_no, price, count(item_no) as count from production where item_no = ?"; I keep getting an error in on my php page: Warning: mysqli_error() expects exactly 1 parameter, 0 given in c:Inetpubwwwrootproductionproduction_line_dail y.php on line 24 Error in query: SELECT id, order_no, price, count(item_no) as count from production where item_no = ?'. If I remove the count(item_no) as count from the query - it works fine. I really want to put the count in though. And eventually the sum.
Count Of Checkboxes (again)
I'm still stuck with this problem. Here's a quick recap/summary :- 1. Page 1:User checks 3 out of 10 checkboxes and submits form to page 2 2. Page 2:Item count shows 3 items. User checks an additional 2 checkboxes and presses Update button. Item count now shows 5 checkboxes are checked and "New" checkboxes remain checked. 3. Page 2:User is happy and submits form to page 3 4. Page 3:Form items are converted into printable text/data Pedro Graca very kindly offered a solution using "header('Location: <URL>')" which very nearly worked however my problem is that the form data needs to be posted to the page 3 when the user is done (if not for this then the solution was perfect). Using header() does not post the data and from what I have read elsewhere there is no way of making it do this. I can think of a really ugly solution by way of changing the form's action to page 3 the first time the Submit (to page 3) button is pressed and tell the user to press it again to get to page 3 but I don't like this much. By the way, I really would prefer to avoid JavaScript.
IRC Online Count
is there any way of getting the online count for an IRC channel? Best, without creating a user and logging in?...
Count() / Query
I want to query mysql to see how many comments exist for an article. Seems easy enough, and things work ok if there are more than 1 comment. My problem is that if there are 0 comments, the count() function returns 1, and when you click to see the comment, it is a empty. I think the problem must be with the query, but not sure. PHP Code:
Count Not Working
I just want to count the number of records in a table that meet a certain set of conditions: Getting an error: Warning: mysql_result(): supplied argument is not a valid MySQL result resource code:
Count Function
The following line prints something: echo $keywords[0][3]; However, when I then use the count function as follows: $count = count($keywords[0]); echo $count; The printed count is only 1. I know there are at least 4 items in the array as I proved above. The array was created with the preg_split function which I don't think matters. I don't know what I'm doing wrong. Seems simple.
Word Count
I was really shocked not to find this already submitted by someone in the PHP manual notes. <? function jnWordCount($text) { $results = array(); $pattern = '/[w0-9]+S+/' // matches wordy characters and numbers preg_match_all($pattern,trim($text),$results); return count($results[0]); } $sentence = ' Should be - (ready) ( 53 ) . , =-' echo jnWordCount($sentence); // outputs 4 // matches: array('Should','be','ready)',ཱ') ?> It counts the number of words ignoring non-wordy charcters and extra whitespace. Infintately better than: <? echo count(explode(' ',$sentence)); ?> Which really only counts the number of spaces not the number of words at all. The reason I'm posting this here is there is just one slight problem. I'm pretty new to regular expressions and they never seem to do exactly what I want. It doesn't seem to want to match single character words. <? echo jnWordCount('a 41 I 5'); // outputs 1. A match for ཥ' only ?>
Count The Instances...
Is there a PHP function that counts the number of time something appears in a MySQL query? So I run the query, and it finds the number of times "[page]" is found in the returned results.
Refresh Count
Is there a way I could get a script that will count how many time the page has been refreshed. I am using meta redirects, but I want to know how many times it refresh.
Count Down Timer
What i have been trying to do is make a count down timer, which counts down two weeks and once its done it waits for a day and then resets it self to count down two weeks again. I have tried. the code below but it doesnt seem to come out right. Code:
COUNT Problem
When I try to count the number of elements in an array (stored in a session array), I can't get it to work. The elements are all present, as when I echo the contents it prints 1, 2, 3, 4 - but when I try counting this it always returns 1. The contents of the session are being brought forward from a previous page, and when I use exactly the same code on that page I get the correct count of 4. Any idea why this would be failing? Code:
Count Records
How can I count how many records are in a table that match a news_id? I have this at the moment, but it doesn't seem to work. Code:
Count Question?
I got a table called item_rating, fields: item_id | user_who_rated | rating e.g data: 7GD | John | 5 7GD | Suzie | 4 7GD | Tim | 5 Ratings go from 1-5.. how do i get a total number of people who rated 1, who rated 2.. etc etcc in the above case for item 7GD it should be like this rating 1: 0 people rating 2: 0 people rating 3: 0 people rating 4: 1 people rating 5: 2 people SELECT * FROM item_rating WHERE item_id='7GD' ..what next guys?
COUNT Not Working
I'm trying to put up a table in PHP that displays how many players there are in the game. I followed proper syntax and everything, and the display I'm getting after the echo is 'Resource id #11'. Code:
Count Down Timer Needs To Be In The Second
i need a count down timer that needs to be precise to the second iff possible it will run over 3 days down to a advent so multiple users can look at the timer and tell when it will happen so every one can do something at the same time.
Count Loop
I'm wanting to count how many "1" there are in a mysql table under a column called "xyz" then loop it to display the top 5 users (user_id) who has the mosts "1"s My database table is like this: user_id | xyz 1 | 1 | 1 2 | 1 2 | 1 So then on my page it shows: User: | XYZs: 2 | 2 1 | 1 I hope that makes sense, I don't know how to loop a SELECT COUNT in this way.
Count Row From Two Tables...
I'm making a forum software for my website and I want to put the number of replies for the listed forum. How would I count the number of rows of the replies table that are in the certain forum?
Php Count Down Timer
how to make a count down timer in seconds. Iv tryed a for loop and using sleep(1) and looping it 5 times but it holds the hole page from loading until the loop has finished. What i want to do is load the hole page then sleep for 5 seconds then display a string.
Reset Count To Zero
On our Intranet, staff can fill in a form requesting permission to purchase items for their department. The online form is numbered like this: NZ - 06 - 183 ....where 06 represents the current financial year, and 186 represents the form number....which is incremented by 1 by selecting the last entry in the db and adding '1' to it. What they want now is for the counter to reset to 001 for the first form filled in at the beginning of the new financial year. By using the date() function and an 'if / else' statement I can determine the start of the new finacial year, but how will I reset the counter to 000....so that the first form filled in on April 1st will have the number 'NZ - 07 - 001'?
Problems With Count(*) - Using MSSQL
Hello all, I am attempting to garner a simple count from a table where the form's username and password are equal to userID and password in the table. PHP/Apache on Linux, MS SQL on a windows box. I receive a count, a count of 2 no matter what I seem to do. Any and all help will be appreciated; I'm switching back and forth between languages right now, and just learning PHP. <?php //error_reporting(E_ERROR); if (isset($HTTP_POST_VARS["submit"])) { //process the form //always connect to the database for a lookup from this page //connect to the database for a lookup $db_hostname = "****"; $db_username = "****"; $db_password = "****"; $dbName = "****"; $cn=MSSQL_CONNECT($db_hostname,$db_username,$db_password); //query the database to see if there is a record which matches //define variables $username=$HTTP_POST_VARS["username"]; $password=$HTTP_POST_VARS["password"]; $query=""; $result="0"; $row=""; $query = "SELECT COUNT(*) AS mycount FROM uid WHERE userID='$username' AND password='$password'"; echo $username; echo $password; $result = MSSQL_QUERY($query,$cn); echo $result; if ($result > 0) { // visitor's name and password combination are correct //register the session variable and offer the correct link to the page echo "<h1>Login correct</h1>"; } else { //visitor's name and password are NOT correct echo "<h1>Login UnSuccessful</h1>"; } }else{ //display form ?>
Getting Field Count From A Table.
I've searched through devshed but haven't found a reference to how to query a database for the contents of a table, then count the number of fields in that table. Can someone help? Say, for instance, the call was FileName.php?table=Vendors In FileName.php, once you'd done all the happy connect stuff, $result = mysql_query("SELECT * FROM $table",$db); how would you count the fields in the result, regardless of the number of rows? I thought I could use mysql_fetch_row($result), then, with a single row selected count through the $myrow[] until they ceased to exist. Is this doable? It seems this would be fairly straightforward. Is there an easier/faster/better way? I'm still thumbing through my php/mysql tomb working on the problem but haven't found an obvious solution. Your thought are sincerely appreciated.
Count Function In MySQL
Displaying in a Table colume - using the count function to display the following entries: ROW#1 Total N's 7 ROW#2 Total R's 5 ROW#3 Diffrence "X" How do I generate the diffrence "X" when N and R were generated using the count function. ROW#1 = SELECT COUNT(CHANGECODE) FROM DATAFARE WHERE CHANGECODE = 'N' ROW#2 = SELECT COUNT(CHANGECODE) FROM DATAFARE WHERE CHANGECODE = 'R'
Getting The Right Results Of Count(distinct(col)) Into Php
Hi guys, I've got the following query, which works from the command line in mysql: mysql> select count(distinct(col)) from table where userid = 1; +-----------------------------+ | count(distinct(col)) | +-----------------------------+ | 96 | +-----------------------------+ 1 row in set (0.07 sec) Which works as I want it, though I am unsure of how to bring that back into something I can use in PHP... when I do a count, I usually use something like this: $count = @mysql_query("SELECT count(*) FROM table where [clause]"); And use: $total = mysql_result($count, 0, "count(*)"); To get the total back. However, if I use: $count = @mysql_query("select count(distinct(col)) from table where userid = 1;"); And this: $total = mysql_result($count, 0, "count(distinct(col))"); I get back 198 - which is the total number of entries, not 96, which is the number of unique topics the user has posted to. To give you an idea of what I'm trying to do: the number I'm after is the number of topics in a bbs system a user has posted to - of course, a user can post to the same thread repeatedly, and in this instance, counting the number of posts as opposed to the number of topics the user has posted to, is not what I'm looking to do....... Any thoughts? :/
Need To Count Clicks.. With A Twist.
Wow am I ever glad I found these forums. I searched the threads and found other people solutions to count clicks, but I need to count clicks to URLs that are called from a flat-file database through a CGI. Okay, so I already got part of it working. I tried 2 different scripts (found at hotscripts.com). One was a perl CGI: GuzZzt Click Count. The problem with this is calling a CGI within a CGI and using SSI to display the click count. I managed to get it to count clicks, but not display the number of clicks next to the URL (necessary). So I tried a new approach with a PHP script: Fast Click. Now this script actually shows the number of clicks next to the link (yay!) but the links don't display a URL in the string. Instead, they're like:
Count The Number Of Columns
I was wondering if there is a way to calculate the total of columns in a table? (something like $totalRows= mysql_num_rows($Recordset1); , but than for columns)
How To Count Image Impressions Using PHP?
I was wondering, what's the basic technique for serving up an image and counting its impressions (hits) using PHP? For example, banner scripts usually have a syntax like so: <img src="image.php"> I was wondering what the source of "image.php" may look like at its core.
|