Re: PHP and MySQL SELECT COUNT (*)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That's your problem, you need to use mysql_fetch_assoc instead of
mysql_fetch_row.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Vinny Gullotta wrote:
> var_dump looks like this:
>
> array(2) { [0]=> string(9) "wehost006" [1]=> string(2) "72" } array(2)
> { [0]=> string(8) "H7848-49" [1]=> string(2) "71" } array(2) { [0]=>
> string(7) "H7853-2" [1]=> string(2) "70" } array(2) { [0]=> string(7)
> "H7842-2" [1]=> string(2) "64" } array(2) { [0]=> string(9)
> "WEHOST005" [1]=> string(2) "64" } array(2) { [0]=> string(7)
> "h7835-2" [1]=> string(2) "57" } array(2) { [0]=> string(9)
> "wehost007" [1]=> string(2) "56" } array(2) { [0]=> string(7)
> "H7814-1" [1]=> string(2) "55" } array(2) { [0]=> string(5) "H0542"
> [1]=> string(2) "54" } array(2) { [0]=> string(8) "H7811-12" [1]=>
> string(2) "54" }
>
>
> ""Dan Joseph"" <dmjoseph@xxxxxxxxx> wrote in message
> news:a20394490809171327sc1ad6bdnd0feaef5b837958c@xxxxxxxxxxxxxxxxx
>> On Wed, Sep 17, 2008 at 4:21 PM, Vinny Gullotta
>> <vgullotta@xxxxxxxxxxxxxx>wrote:
>>
>>> var_dump($i); looks messy, but I can see the server names in there
>>> and they
>>> are the correct names.
>>>
>>>
>>> "Micah Gersten" <micah@xxxxxxxxxxx> wrote in message
>>> news:48D1629D.3040801@xxxxxxxxxxxxxx
>>>
>>>  Do var_dump($i) in the loop to see if you're getting the data you
>>> want.
>>>>
>>>> Thank you,
>>>> Micah Gersten
>>>> onShore Networks
>>>> Internal Developer
>>>> http://www.onshore.com
>>>>
>>>>
>>>>
>>>> Vinny Gullotta wrote:
>>>>
>>>>> Still no luck displaying the stupid servername. Any other things I
>>>>> can
>>>>> try?
>>>>>
>>>>>
>>>>> "Micah Gersten" <micah@xxxxxxxxxxx> wrote in message
>>>>> news:48D15B41.8010208@xxxxxxxxxxxxxx
>>>>>
>>>>>> You'll want to change your Order By statement to 'ORDER BY
>>>>>> CountSteps
>>>>>> DESC'.
>>>>>>
>>>>>> Thank you,
>>>>>> Micah Gersten
>>>>>> onShore Networks
>>>>>> Internal Developer
>>>>>> http://www.onshore.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> Vinny Gullotta wrote:
>>>>>>
>>>>>>> echo $query;
>>>>>>>
>>>>>>> yields
>>>>>>>
>>>>>>> SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE
>>>>>>> steps = 'IISRESET' AND timestamp <= '2008-09-17 11:40:34' AND
>>>>>>> timestamp >= '2008-08-17' GROUP BY servername ORDER BY COUNT(*)
>>>>>>> DESC
>>>>>>> LIMIT 10
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>> -- 
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> Can you show us one of the var_dumps?
>>
>> -- 
>> -Dan Joseph
>>
>> www.canishosting.com - Plans start @ $1.99/month.
>>
>> "Build a man a fire, and he will be warm for the rest of the day.
>> Light a man on fire, and will be warm for the rest of his life."
>>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux