| [PHP] counting with PHP | |
|---|---|
| Tweet Topic Started: Mar 3 2009, 02:13 PM (300 Views) | |
| PauloMillerz | Mar 3 2009, 02:13 PM Post #1 |
![]()
|
Ok i had no luck yet on this one in the other forums so trying here.... see how our brainy guys here can do!! ;O
Do not double post -Alex Edited by Alex, Mar 3 2009, 04:23 PM.
|
If you like... RATE IT!! Add to my reputation to the left?
| |
![]() |
|
| Dillon | Mar 3 2009, 06:07 PM Post #2 |
|
What type of database are you using? This is how I would do it in MySQL, This is just a quick thing I threw together...
Hope this helps! -Dillon Edited by Dillon, Mar 3 2009, 06:08 PM.
|
|
<? $text == "Hello World"; echo $text; ?> | |
![]() |
|
| Darksorrow131 | Mar 3 2009, 08:15 PM Post #3 |
|
As Dillon said, if the "variables" you talked about come from a database, just use SELECT COUNT(*) FROM TABLE WHERE var = NU and it will return 3. If they are simply in an array, write a loop through the array and increment a counter each time you see 'NU'. |
|
(let loop () (loop)) ((lambda (x) (x x)) (lambda (x) (x x))) (let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k)) ((call/cc call/cc) (call/cc call/cc)) -- Infinite loops are awesome! -- Tell me if you have other awesome infinite loops! | |
![]() |
|
| PauloMillerz | Mar 4 2009, 07:43 AM Post #4 |
![]()
|
No the variables are actual php $ variables.. which has come from a database, yes mysql.. reason they are in varaibles is because I have got them printed elsewhere on the page. I've got 15 team names, e.g. AV, MU, ST etc etc.. I'm trying to avoid using the database to store this info because it means setting it up in various places. Basically at the moment i have the team in a table and all the player data in another one. At the moment the script here is getting the player names from the one table and putting that into the query for the player data to get the club they play for, and then putting each one in a $variable... Edit: Bah I'll put it into the table.. at least i can do stuff with the data then a lot easier.. Edited by PauloMillerz, Mar 6 2009, 06:49 AM.
|
If you like... RATE IT!! Add to my reputation to the left?
| |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Web-Based Programming Support · Next Topic » |







10:18 AM Jul 11