Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread Fernando
How did you created the table? Can you count the Id's only? Wouldn't this just count the entries in the index? On 28/01/2011 12:57, AmirBehzad Eslami wrote: Dear list, The common solution for counting online users is to store sessions in a Table. I've created a Table in MySQL to acheive the

Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread Jim Lucas
On 1/28/2011 9:57 AM, AmirBehzad Eslami wrote: Dear list, The common solution for counting online users is to store sessions in a Table. I've created a Table in MySQL to acheive the result, but it seems this solution is a little heavy for such a simple task. Is there a better

Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread AmirBehzad Eslami
Jim, I'm already using the solution you mentioned. The problem is about the performance. One solution is to increase the performance by using Memcached. But counting online users always requires a __new__fresh__ COUNT(*) query, even under Memcahched. Since the COUNT(*) result is very dynamic and

Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread David Harkness
If you're using memcached already you could store the number in it and update it only when a user logs in/out. If no one is logging in/out, the number isn't changing. If your site is so popular that hundreds of users are logging in every second you might want to change the logic so that the

Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread Marc Guay
I'm looking for a faster way to count online users. COUNT(*) is time consuming under MySQL. If COUNTing is the heavy part, why not create a 'users_logged_in' field somewhere and increment it when someone logs in and decrement it when someone logs out? Then your query is just a straight

Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread David Harkness
On Fri, Jan 28, 2011 at 11:03 AM, Marc Guay marc.g...@gmail.com wrote: If COUNTing is the heavy part, why not create a 'users_logged_in' field somewhere and increment it when someone logs in and decrement it when someone logs out? Then your query is just a straight SELECT. If this is like

Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread Jim Lucas
On 1/28/2011 11:23 AM, David Harkness wrote: On Fri, Jan 28, 2011 at 11:03 AM, Marc Guay marc.g...@gmail.com wrote: If COUNTing is the heavy part, why not create a 'users_logged_in' field somewhere and increment it when someone logs in and decrement it when someone logs out? Then your query

Re: [PHP] Counting Occurrences within an If statement

2008-07-20 Thread Micah Gersten
If it's a simple x y, you might want to consider putting your if statement in the SQL query so you don't return so many rows. To make a counter, just set a variable like: $counter = 0; if ($x $y) { print $row; $counter++ } Thank you, Micah Gersten onShore Networks Internal Developer

Re: [PHP] counting with leading zeros

2007-10-01 Thread Martin Alterisio
// glob returns an ordered list (rtfm: man glob) // relies on the use of the operator ++ to generate string sequences. function lastFileInSequence($path, $prefix, $first, $suffix) { return array_pop(glob($path . / . $prefix . str_repeat('?', strlen($first)) . $suffix)); } function

Re: [PHP] counting with leading zeros

2007-09-30 Thread Robert Cummings
On Sat, 2007-09-29 at 23:47 -0400, brian wrote: It's not so much that i disrespect Rob. It's just that i felt i had to call him out for being a dickhead by taking my statement out of context. Ok, so I'm a dickhead. What does that make you? A vagina? Name calling really is the lowest form of

Re: [PHP] counting with leading zeros

2007-09-30 Thread Jeffery Fernandez
gee you guys behave like kids. don't you all have other things to do than whinge, swear and blame each other on the list? Take it elsewhere and sort it out. This is bad for the PHP community in general. It doesn't reflect what the community is about. my 2c. On Sunday 30 September 2007 13:47,

Re: [PHP] counting with leading zeros

2007-09-30 Thread tedd
At 11:47 PM -0400 9/29/07, brian wrote: You and i have had our run-ins on this list on more than one occasion. Until now, i've chosen to take your crap in stride. brian I haven't noticed any run-ins. I don't care if you've been the biggest prick on the net -- if you ask a question and it's

Re: [PHP] counting with leading zeros

2007-09-29 Thread brian
tedd wrote: At 8:30 PM -0400 9/27/07, brian wrote: I wasn't bitching! And i *thought* that my numerous attempts at explaining such would have been enough. Obviously not, but wtf can you do with people who seem to want only to stir up shit? It sure sounded like you were bitching. Gee,

Re: [PHP] counting with leading zeros

2007-09-28 Thread tedd
At 8:30 PM -0400 9/27/07, brian wrote: I wasn't bitching! And i *thought* that my numerous attempts at explaining such would have been enough. Obviously not, but wtf can you do with people who seem to want only to stir up shit? It sure sounded like you were bitching. And, your off-list fuck

RE: [PHP] counting with leading zeros

2007-09-28 Thread Dan Parry
: tedd [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 17:20 To: brian; php-general@lists.php.net Subject: Re: [PHP] counting with leading zeros At 8:30 PM -0400 9/27/07, brian wrote: I wasn't bitching! And i *thought* that my numerous attempts at explaining such would have been enough

Re: [PHP] counting with leading zeros

2007-09-27 Thread Robert Cummings
On Wed, 2007-09-26 at 21:56 -0700, Jim Lucas wrote: Now, if you plan to delete any images in the list, this will not work. But if you don't expect to delete any images in the list and always want the ($total_images + 1), then follow along. ?php function getNextImage($path, $prefix) {

Re: [PHP] counting with leading zeros

2007-09-27 Thread tedd
Robert Cummings wrote: Suit yourself. But better programmer's don't just wave their hands in the air and hope for the best. Ah crap -- there's another technique I have to cross off my list. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com --

Re: [PHP] counting with leading zeros

2007-09-27 Thread tedd
At 3:58 PM -0400 9/26/07, brian wrote: Well, this is almost precisely the same thing i have, save for using POSIX character classes, str_pad instead of sprintf(), and incrementing elsewhere. What i was really wondering is if there was a *much simpler* way to do this, not just re-arranging

Re: [PHP] counting with leading zeros

2007-09-27 Thread tedd
At 10:39 PM -0400 9/26/07, brian wrote: Now you're obviously just trying to be a dickhead. While someone is, it's not Rob. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] counting with leading zeros

2007-09-27 Thread brian
tedd wrote: At 3:58 PM -0400 9/26/07, brian wrote: Well, this is almost precisely the same thing i have, save for using POSIX character classes, str_pad instead of sprintf(), and incrementing elsewhere. What i was really wondering is if there was a *much simpler* way to do this, not just

Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 15:11 -0400, brian wrote: I have a directory that contains many images (no, not pr0n, unfortunately) and i'm working on an admin script for adding to it. I've got something that works alright but i'm wondering if there's a Better Way. Each image is named like:

Re: [PHP] counting with leading zeros

2007-09-26 Thread brian
Robert Cummings wrote: On Wed, 2007-09-26 at 15:11 -0400, brian wrote: I have a directory that contains many images (no, not pr0n, unfortunately) and i'm working on an admin script for adding to it. I've got something that works alright but i'm wondering if there's a Better Way. Each image

Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 15:58 -0400, brian wrote: Robert Cummings wrote: On Wed, 2007-09-26 at 15:11 -0400, brian wrote: I have a directory that contains many images (no, not pr0n, unfortunately) and i'm working on an admin script for adding to it. I've got something that works alright

Re: [PHP] counting with leading zeros

2007-09-26 Thread brian
Robert Cummings wrote: On Wed, 2007-09-26 at 15:58 -0400, brian wrote: Robert Cummings wrote: On Wed, 2007-09-26 at 15:11 -0400, brian wrote: I have a directory that contains many images (no, not pr0n, unfortunately) and i'm working on an admin script for adding to it. I've got

Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 19:10 -0400, brian wrote: Robert Cummings wrote: Well, this is almost precisely the same thing i have, save for using POSIX character classes, str_pad instead of sprintf(), and incrementing elsewhere. What i was really wondering is if there was a *much simpler*

Re: [PHP] counting with leading zeros

2007-09-26 Thread brian
Robert Cummings wrote: On Wed, 2007-09-26 at 19:10 -0400, brian wrote: If my response to that gave you the impression i was complaining, i assure you that i wasn't. I was simply suggesting that i was wondering if there was a *much* simpler way to do this, ie. without using several functions to

Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 22:39 -0400, brian wrote: Robert Cummings wrote: On Wed, 2007-09-26 at 19:10 -0400, brian wrote: If my response to that gave you the impression i was complaining, i assure you that i wasn't. I was simply suggesting that i was wondering if there was a *much* simpler

Re: [PHP] counting with leading zeros

2007-09-26 Thread brian
Robert Cummings wrote: When you use sort() the default behaviour is a lexical sort. This is why the 100th index breaks your system. I'm not trying to be a dickhead, just pointing out the flaw in your logic. You may be well aware that in counting 100 comes after 99, but it would seem you are not

Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Thu, 2007-09-27 at 00:23 -0400, brian wrote: Robert Cummings wrote: When you use sort() the default behaviour is a lexical sort. This is why the 100th index breaks your system. I'm not trying to be a dickhead, just pointing out the flaw in your logic. You may be well aware that in

Re: [PHP] counting with leading zeros

2007-09-26 Thread Jim Lucas
brian wrote: I have a directory that contains many images (no, not pr0n, unfortunately) and i'm working on an admin script for adding to it. I've got something that works alright but i'm wondering if there's a Better Way. Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so

Re: [PHP] Counting Capital Letters

2007-06-21 Thread Robin Vickery
On 21/06/07, Richard Davey [EMAIL PROTECTED] wrote: Hi, I've written a short regexp which will *count* how many capital letters are in a given string (the woefully simple: '/[A-Z]/') Although it's an English language web site, I'm curious how you'd count capital letters that span beyond just

Re: [PHP] Counting Capital Letters

2007-06-21 Thread tedd
At 12:32 AM +0100 6/21/07, Richard Davey wrote: Hi, I've written a short regexp which will *count* how many capital letters are in a given string (the woefully simple: '/[A-Z]/') Although it's an English language web site, I'm curious how you'd count capital letters that span beyond just the

Re: [PHP] counting code lines

2007-06-14 Thread James McLean
On 6/15/07, Toni Torello [EMAIL PROTECTED] wrote: hi guys, just supposing... which is the right way to to count the number of code lines in a php application? do you think that the raw: $ find . -name '*.php' -exec cat {} \; | wc -l can be a good estimate? I recently desired to know a

Re: [PHP] counting hyperlink clicks in php

2007-02-20 Thread Fergus Gibson
Brad Bonkoski wrote: I think the best way to do this would be to set an onClick (Javascript) event handler for each of the links, and then use AJAX style stuff to send the information to PHP on the server side, then PHP can log the link that was clicked, and keep track of the most clicked

Re: [PHP] counting hyperlink clicks in php

2007-02-20 Thread Richard Lynch
On Sat, February 17, 2007 1:53 pm, clive wrote: Denis L. Menezes wrote: Dear friends. I have a site where I have news headers. I wish to count the clicks on the news headers so that I can see how many times each of the the news has been viewed. This way I can show the most viewed news.

Re: [PHP] counting hyperlink clicks in php

2007-02-17 Thread Brad Bonkoski
Denis L. Menezes wrote: Dear friends. I have a site where I have news headers. I wish to count the clicks on the news headers so that I can see how many times each of the the news has been viewed. This way I can show the most viewed news. Can one of you please advise hwo this can be done?

Re: [PHP] counting hyperlink clicks in php

2007-02-17 Thread clive
Denis L. Menezes wrote: Dear friends. I have a site where I have news headers. I wish to count the clicks on the news headers so that I can see how many times each of the the news has been viewed. This way I can show the most viewed news. Can one of you please advise hwo this can be done?

Re: [PHP] Counting the occurences of items in an array

2006-12-24 Thread Sumeet
Dotan Cohen wrote: Has this wheel been invented, but simpler? I've an array of words that I'd like to know how many occurences of each there are. For instance: $fruits = array( lemon, orange, banana, apple, orange, banana, orange); And I'd like to create this:

Re: [PHP] Counting the occurences of items in an array

2006-12-24 Thread tedd
At 8:35 PM +0200 12/24/06, Dotan Cohen wrote: Has this wheel been invented, but simpler? I've an array of words that I'd like to know how many occurences of each there are. For instance: $fruits = array( lemon, orange, banana, apple, orange, banana, orange); And I'd

Re: [PHP] Counting the occurences of items in an array

2006-12-24 Thread Dotan Cohen
Thanks for the link to the function. Know that I did RTFM before posting, but I missed that one. Dotan Cohen http://lyricslist.com/lyrics/artist_albums/219/xyz.php http://simplesniff.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] counting clicks

2006-11-29 Thread Jay Blanchard
[snip] Anyone got a script so I can count clicks on adverts. Doesn't have tosve to myqsl or anything just a text file will do. [/snip] ?php if(yes == $adClicked){ $adClickCountFile = fopen(countClick.txt, w); $getCount = fgets($adClickCountFile, 4096); $newCount = $getCount + 1;

RE: [PHP] counting clicks

2006-11-29 Thread Richard Lynch
On Wed, November 29, 2006 11:21 am, Jay Blanchard wrote: [snip] Anyone got a script so I can count clicks on adverts. Doesn't have tosve to myqsl or anything just a text file will do. [/snip] ?php if(yes == $adClicked){ $adClickCountFile = fopen(countClick.txt, w); $getCount =

RE: [PHP] counting clicks

2006-11-29 Thread Jay Blanchard
[snip] This has a race condition where a busy server, or even a not-so-busy one where 2 people happen to click at the same time, at least one of them will be missed, at best. There's also a distinct possiblity of the counter file getting completely trashed, depending on the OS and its underlying

Re: [PHP] counting clicks

2006-11-29 Thread clive
Ross wrote: Anyone got a script so I can count clicks on adverts. Doesn't have tosve to myqsl or anything just a text file will do. What about using mysql, but use a memory resident heap table, then every once in a while write this to a file or even better to a myisam table Ta Ross

Re: [PHP] counting records in db

2006-10-31 Thread Ivo F.A.C. Fokkema
On Mon, 30 Oct 2006 12:28:29 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the

Re: [PHP] counting records in db

2006-10-31 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-27 20:14:58 +0200: And the header(Location: ...) requires a full URL. Why? HTTP protocol specification[1] says: 14.30 Location The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of

Re: [PHP] counting records in db

2006-10-31 Thread Robin Vickery
On 30/10/06, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On

Re: [PHP] counting records in db

2006-10-31 Thread Richard Lynch
On Tue, October 31, 2006 4:58 am, Robin Vickery wrote: On 30/10/06, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On

Re: [PHP] counting records in db

2006-10-31 Thread Robert Cummings
On Tue, 2006-10-31 at 11:58 +0100, Robin Vickery wrote: On 30/10/06, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:

Re: [PHP] counting records in db

2006-10-30 Thread Ivo F.A.C. Fokkema
On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but he's missing an ' at first glance Yes, it does:

Re: [PHP] counting records in db

2006-10-30 Thread Robin Vickery
On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but

Re: [PHP] counting records in db

2006-10-30 Thread Robert Cummings
On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote: On 30/10/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote: On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote: On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the

Re: [PHP] counting records in db

2006-10-29 Thread Richard Lynch
On Fri, October 27, 2006 12:14 pm, [EMAIL PROTECTED] wrote: And the header(Location: ...) requires a full URL. Why? Because the docs say so? Because some user agents will not do what you want them to if you don't? -- Some people have a gift link here. Know what I want? I want you to buy a CD

Re: [PHP] counting records in db

2006-10-29 Thread Richard Lynch
On Fri, October 27, 2006 4:53 pm, Børge Holen wrote: On Friday 27 October 2006 19:34, Richard Lynch wrote: And the header(Location: ...) requires a full URL. No it doesn't. but he's missing an ' at first glance Yes, it does: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30

Re: [PHP] counting records in db

2006-10-27 Thread Satyam
- Original Message - From: Paul Novitski [EMAIL PROTECTED] While we're talking about optimization, I'd want to check to make sure COUNT(*) didn't ask MySQL to generate a throw-away recordset consisting of all fields. I wonder if it would be more machine-efficient to use

Re: [PHP] counting records in db

2006-10-27 Thread Richard Lynch
Your idea to use 'COUNT(Username)' is just about the ONLY part of that script that you are doing correctly... :-) Start reading here: http://phpsec.org/ And the header(Location: ...) requires a full URL. And you should have better error-checking, probably. [Though maybe you have a custom error

Re: [PHP] counting records in db

2006-10-27 Thread afan
Your idea to use 'COUNT(Username)' is just about the ONLY part of that script that you are doing correctly... :-) :D And the header(Location: ...) requires a full URL. Why? And you should have better error-checking, probably. [Though maybe you have a custom error handler not apparent]

Re: [PHP] counting records in db

2006-10-27 Thread Børge Holen
On Friday 27 October 2006 19:34, Richard Lynch wrote: Your idea to use 'COUNT(Username)' is just about the ONLY part of that script that you are doing correctly... :-) Start reading here: http://phpsec.org/ And the header(Location: ...) requires a full URL. No it doesn't. but he's

Re: [PHP] counting records in db

2006-10-26 Thread Dave Goodchild
$query = mysql_query( SELECT COUNT(*) as NoOfRecords FROM customers WHERE last_name = 'Smith'); $result = mysql_result($query, 0);

Re: [PHP] counting records in db

2006-10-26 Thread afan
WOW! That was fast! :D Thanks Dave! -afan $query = mysql_query( SELECT COUNT(*) as NoOfRecords FROM customers WHERE last_name = 'Smith'); $result = mysql_result($query, 0); -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] counting records in db

2006-10-26 Thread afan
Hm. There is a little problem - this doesn't work. Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/html/xxx/tests/count.php on line 28 ? $query = mysql_query( SELECT COUNT(*) as NoOfRecords FROM customers

Re: [PHP] counting records in db

2006-10-26 Thread Paul Novitski
At 10/26/2006 10:38 AM, [EMAIL PROTECTED] wrote: what would be better solution to count records in table (e.g., how many customers have last name 'Smith'): $query = mysql_query( SELECT COUNT(*) as NoOfRecords FROM customers WHERE last_name =

Re: [PHP] counting records in db

2006-10-26 Thread afan
Sorry, my bad! It works jsut fine. I did misstake. :) $query = mysql_query( SELECT COUNT(*) as NoOfRecords FROM customers WHERE last_name = 'Smith'); $result = mysql_result($query, 0); -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] counting records in db

2006-10-26 Thread Richard Lynch
On Thu, October 26, 2006 12:57 pm, Paul Novitski wrote: $query = mysql_query( SELECT COUNT(*) as NoOfRecords FROM customers WHERE last_name = 'Smith'); $result = mysql_fetch_array($query); $NoOfRecords = $result['NoOfRecords']; This would be

Re: [PHP] counting records in db

2006-10-26 Thread afan
Would it be ok to use the same code to check if customer is loged in? $query = mysql_query( SELECT COUNT(Username) as NoOfRecords FROM customers WHERE Username = '$Username' AND Password = '$Password'); if (mysql_result($query, 0) == 0) { echo

Re: [PHP] counting records in db

2006-10-26 Thread Dave Goodchild
Why would you want to do that? Think about what you're trying to do. In the first case you want a COUNT of records in the database, in the second you just want to see if the user/password combination or whatever exist, so just use a normal SELECT query, no need to use the wrong tool for the

RE: [PHP] counting records in db

2006-10-26 Thread Brad Fuller
Would it be ok to use the same code to check if customer is loged in? $query = mysql_query( SELECT COUNT(Username) as NoOfRecords FROM customers WHERE Username = '$Username' AND Password = '$Password'); if (mysql_result($query, 0) == 0) {

Re: [PHP] counting records in db

2006-10-26 Thread Paul Novitski
At 10/26/2006 11:16 AM, [EMAIL PROTECTED] wrote: Would it be ok to use the same code to check if customer is loged in? $query = mysql_query( SELECT COUNT(Username) as NoOfRecords FROM customers WHERE Username = '$Username' AND Password =

Re: [PHP] counting records in db

2006-10-26 Thread afan
Would it be ok to use the same code to check if customer is loged in? $query = mysql_query( SELECT COUNT(Username) as NoOfRecords FROM customers WHERE Username = '$Username' AND Password = '$Password'); if (mysql_result($query, 0) == 0) I just

Re: [PHP] Counting files in directory and subdirectory!

2006-01-25 Thread tomasz abramowicz
start here: http://www.php.net/readdir check out as well: 'string functions' for finding 'amrs' and loops to make recursive search... t. Nicholas Couloute wrote: I want a script where it will count all the amrs in a folder and it's sub folders like this setup: amrs 50 cent amrs

RE: [PHP] Counting files in directory and subdirectory!

2006-01-25 Thread Weber Sites LTD
You can start with looking at some code examples that do similar things : Directory browser http://www.weberdev.com/get_example-1539.html How to get a dir listing of the current dir of php script in an array http://www.weberdev.com/get_example-1855.html filesystem Show Files Script

Re: [PHP] Counting files in directory and subdirectory!

2006-01-25 Thread Nicholas Couloute
I have used these functions but how would I count them! here is my attempt that doesn't work!: $count = 0; $dir = /amrs; $files1 = scandir($dir); if ($files1 !== '.' $files1 !== '..') { foreach ($files1 as $files2){ $dir2 = /amrs/$files2; $files3 = scandir($dir2); if ($files3 !== '.' $files3

Re: [PHP] Counting files in directory and subdirectory!

2006-01-25 Thread Nicholas Couloute
here is what I tried but it doesn't work! any advice suggestions or something? $count = 0; $dir = /amrs; $files1 = scandir($dir); if ($files1 !== '.' $files1 !== '..') { foreach ($files1 as $files2){ $dir2 = /amrs/$files2; $files3 = scandir($dir2); if ($files3 !== '.' $files3 !== '..') {

Re: [PHP] Counting files in directory and subdirectory!

2006-01-25 Thread David Tulloh
That is some nasty code... Anything that has repitition like that needs a substantial rewrite, but I'm guessing that you know that, hence the e-mail. I just knocked up the following function, powered by the magic of recursion. It should be close to what you were trying to do. function

RE: [PHP] Counting in Hex

2006-01-04 Thread Ben Miller
Never mind - wasn't adding properly. Found it after all on php.net, anyway. Thanks anyway. -Original Message- From: Ben Miller [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 04, 2006 5:01 PM To: php-general@lists.php.net Subject: [PHP] Counting in Hex Is there a way in PHP to count

Re: [PHP] counting nested array

2005-08-17 Thread Robin Vickery
On 8/17/05, Ing. Josué Aranda [EMAIL PROTECTED] wrote: OK this the little function i made to solve this.. function countNested($array){ foreach($array as $value){ if(is_array($value)) $total=$this-countNested($value)+$total; }else{

Re: [PHP] counting nested array

2005-08-17 Thread Ing . Josué Aranda
hahaha, thanks robin you save some seconds of mi life... it looks more pro with that if... On 8/17/05, Robin Vickery [EMAIL PROTECTED] wrote: On 8/17/05, Ing. Josué Aranda [EMAIL PROTECTED] wrote: OK this the little function i made to solve this.. function countNested($array){

Re: [PHP] counting nested array

2005-08-16 Thread Torgny Bjers
Ing. Josué Aranda wrote: Hi to everyone.. now i have a little problem counting an nested array. Im using it to fill a Java TreeView... it looks like this: [snip] The number of the branches is not always the same.. (it depends on the query).. when i use count($array, COUNT_RECURSIVE) for nested

Re: [PHP] counting nested array

2005-08-16 Thread Robin Vickery
On 8/16/05, Ing. Josué Aranda [EMAIL PROTECTED] wrote: The number of the branches is not always the same.. (it depends on the query).. when i use count($array, COUNT_RECURSIVE) for nested arrays.. it give to me the total including the nodes in the branches ( in this case 28).. now here is the

Re: [PHP] counting nested array

2005-08-16 Thread Ing . Josué Aranda
OK this the little function i made to solve this.. [CODE] function countNested($array){ foreach($array as $value){ if(is_array($value)) $total=$this-countNested($value)+$total; }else{ $total=$total+1; } }

Re: [PHP] counting ocuring words in a string

2005-05-17 Thread Petar Nedyalkov
On Tuesday 17 May 2005 13:00, Merlin wrote: Hi there, I am trying to find a way to count the number of times (if any) words are inside a string. So I played around with ereg, preg_match_all and so on, but could not put together a working code. Can anybody help me on that? This is the

Re: [PHP] counting ocuring words in a string

2005-05-17 Thread Brian V Bonini
On Tue, 2005-05-17 at 06:00, Merlin wrote: Hi there, I am trying to find a way to count the number of times (if any) words are inside a string. So I played around with ereg, preg_match_all and so on, but could not put together a working code. Maybe something like this? ?php $words =

Re: [PHP] counting ocuring words in a string

2005-05-17 Thread Jason Wong
On Tuesday 17 May 2005 18:00, Merlin wrote: I am trying to find a way to count the number of times (if any) words are inside a string. explode() array_count_values() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting *

Re: [PHP] Counting numbers on while..

2005-03-28 Thread Devraj Mukherjee
You basically dont need the for loop all you have to do is increment the value of the variable by one each time in the while loop Devraj Louie Miranda wrote: Hi, im trying to create a number loop on a table where the data came in a database. I have tried the for loop and counted

Re: [PHP] counting chars..

2004-12-15 Thread Jake Press
Hi Louie, Excellent example! i wish more users would take the time to provide such clear examples. The strlen() exists for you :) ie. ?php $string = function yes good; $display = strlen($string); echo $display; ? :) Best Regards Jake Press Louie Miranda wrote: ?php $string = function yes good;

Re: [PHP] counting chars..

2004-12-15 Thread Robby Russell
On Thu, 2004-12-16 at 14:28 +0800, Louie Miranda wrote: ?php $string = function yes good; $display = count_chars($string); echo $display; ? i know this is wrong, but how can i count chars used here? php.net/strlen ? -Robby -- /*** * Robby Russell |

Re: [PHP] Counting download problem

2004-07-20 Thread Jason Wong
On Tuesday 20 July 2004 16:44, Rausch Alexandru wrote: I have a script that creates automatically a zip arhive. The script works fine, but I want to count downloads, and I made that to, but if the user click cancel in the download panel the download it is also counting. How can I prevent this

Re: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Tom Rogers
Hi, Friday, April 23, 2004, 11:50:56 PM, you wrote: RD Hi all, RD It's a warm sunny day and I'm trying to wrap my head around the RD following: RD I want to be able to check to see if, in a string, the user has RD entered too many consecutive characters and not enough spaces. For RD example

Re: [PHP] Counting number of characters without spaces between them?

2004-04-23 Thread Chris Shiflett
--- Richard Davey [EMAIL PROTECTED] wrote: I want to be able to check to see if, in a string, the user has entered too many consecutive characters and not enough spaces. For example they might enter a subject like: hello world! how arrre you today?!! Does

Re: [PHP] counting downloaded files

2004-02-10 Thread Marek Kilimajer
Adriaan Nel wrote: Hi, I am using the following piece of code, to download files, but the files are allways corrupt...what am I doing wrong? if ($submit) { $full_filename = $_POST[full_filename]; $filename = $_POST[filename]; $dir = $_POST['dir']; $size = $_POST[size]; $id = $_POST[id];

Re: [PHP] counting downloaded files

2004-02-10 Thread Adriaan Nel
The variables I submit, are retrieved from a database...so users can't enter anything, I do have a warning inserted at the beginning of the file, how do I remove this warning? Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Adriaan Nel wrote: Hi, I am using the

Re: [PHP] counting downloaded files

2004-02-10 Thread Marek Kilimajer
Adriaan Nel wrote: The variables I submit, are retrieved from a database...so users can't enter anything, What do you mean? Even if the variables are in a hidden input field, anyone can change them. For example one can save the page and change them in html source. I do have a warning inserted

RE: [PHP] counting charactors

2004-01-06 Thread Jay Blanchard
[snip] can someone point me to the right place for a thing that would count charactors in a string? [/snip] http://www.php.net/strlen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] counting charactors

2004-01-06 Thread Richard Davey
Hello Philip, Tuesday, January 6, 2004, 6:25:34 PM, you wrote: PJN can someone point me to the right place for a thing that PJN would count charactors in a string? count_chars() and strlen() -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing

Re: [PHP] counting charactors

2004-01-06 Thread Tyler Longren
Hi Philip, strlen() will work. http://www.php.net/manual/en/function.strlen.php Best Regards, -- Tyler Longren J.D. Web Services, L.C. On Wed, 2004-01-07 at 01:25, Philip J. Newman wrote: can someone point me to the right place for a thing that would count charactors in a string? ---

Re: [PHP] Counting back 90 days...

2004-01-05 Thread Richard Davey
Hello Tristan, Monday, January 5, 2004, 11:29:16 AM, you wrote: TPrsc But is there an easy was to calculate 90 days from the timestamp... Based on the current time: $previous_90_days_timestamp = strtotime (-90 day); All in one: $previous_90_days_date = date(Y-m-d, strtotime(-90 day)); --

Re: [PHP] Counting back 90 days...

2004-01-05 Thread Jon Haworth
Hi Tris, But is there an easy was to calculate 90 days from the timestamp... There are 86400 seconds in a day... can't you just do something like: $timestamp -= (86400 * 90); Or even $timestamp -= 7776000; // 90 days Cheers Jon -- PHP General Mailing List (http://www.php.net/) To

RE: [PHP] Counting back 90 days...

2004-01-05 Thread Jami
Easier way to do that is like so: $archive_date = date(Y-m-d, (time()-(86400*90))); I use this same kind of calculation for getting a date in the future. 86400 is the number of seconds in a day. Time returns the Unix Timestamp, just like you would get with mktime(). Makes for a lot less code and

Re: [PHP] Counting back 90 days...

2004-01-05 Thread Tristan . Pretty
My word... 6 odd lines, to one... you're a genius... Cheers for that... Tris... Richard Davey [EMAIL PROTECTED] 05/01/2004 11:45 Please respond to Richard Davey [EMAIL PROTECTED] To [EMAIL PROTECTED] cc [EMAIL PROTECTED] [EMAIL PROTECTED] Subject Re: [PHP] Counting back 90 days

Re: [PHP] Counting back 90 days...

2004-01-05 Thread Paul Chvostek
Richard Davey [EMAIL PROTECTED] 05/01/2004 11:45: Based on the current time: $previous_90_days_timestamp = strtotime (-90 day); All in one: $previous_90_days_date = date(Y-m-d, strtotime(-90 day)); On Mon, Jan 05, 2004 at 11:55:36AM +, [EMAIL PROTECTED] wrote: My word... 6 odd

  1   2   >