RE: [PHP] Can i do this?
| From: | Martin Towell | Date: | Thu, 13 Dec 2001 22:38:27 +0000 |
| Subject: | RE: [PHP] Can i do this? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77681@lists.php.net to get a copy of this message | ||
try:
echo $num_vals[0][0]; // should display 0
echo $num_vals[0]["COUNT(*)"]; // should display 0
echo $num_vals[1][0]; // should display 0
echo $num_vals[1]["COUNT(*)"]; // should display 0
echo $num_vals[2][0]; // should display 5
echo $num_vals[2]["COUNT(*)"]; // should display 5
// etc...
-----Original Message-----
From: Daniel Alsén [mailto:d@mindbash.com]
Sent: Friday, December 14, 2001 9:31 AM
To: PHP; Jack Dempsey
Subject: RE: [PHP] Can i do this?
Yep...
And i don´t get any wiser. I have tried all sorts of combinations. But i
can´t get the damn values printed.
This is how the print_r of $num_vals looks:
( [0] => Array ( [0] => 0 [COUNT(*)] => 0 )
[1] => Array ( [0] => 0 [COUNT(*)] => 0 )
[2] => Array ( [0] => 5 [COUNT(*)] => 5 )
[3] => Array ( [0] => 6 [COUNT(*)] => 6 )
[4] => Array ( [0] => 7 [COUNT(*)] => 7 )
[5] => Array ( [0] => 7 [COUNT(*)] => 7 )
[6] => Array ( [0] => 9 [COUNT(*)] => 9 )
[7] => Array ( [0] => 11 [COUNT(*)] => 11 )
[8] => Array ( [0] => 8 [COUNT(*)] => 8 )
[9] => Array ( [0] => 9 [COUNT(*)] => 9 ) )
Ideas?
Regards
Daniel
> -----Original Message-----
> From: Jack Dempsey [mailto:dempsejn@georgetown.edu]
> Sent: den 13 december 2001 16:30
> To: Daniel Alsén; PHP
> Subject: RE: [PHP] Can i do this?
>
>
> didn't check your code specifically, but you can definitely have arrays
> nested inside of arrays...to see how to print them out use something like
> print_r to look at the structure...
>
> -----Original Message-----
> From: Daniel Alsén [mailto:d@mindbash.com]
> Sent: Thursday, December 13, 2001 10:12 AM
> To: PHP
> Subject: [PHP] Can i do this?
>
>
> Hi,
>
> can i do this?
>
> $num_vals = array ();
> for ($i=0; $i<10; $i++)
> {
> $shot_count = "SELECT COUNT(*) FROM statistik WHERE
> shooter='$shooter_login' && shot_one = '$i' ||
> shooter='$shooter_login' &&
> shot_two = '$i' || shooter='$shooter_login' && shot_three =
> '$i' ||
> shooter='$shooter_login' && shot_four = '$i' ||
> shooter='$shooter_login' &&
> shot_five = '$i'";
> $result = mysql_query($shot_count);
> $num_vals[$i] = mysql_fetch_array($result);
> }
>
> I guess it´s the last row that is troubling - getting an array into an
> array. If the code is good - how do i echo the results?
>
> # Daniel Alsén | www.mindbash.com #
> # d@mindbash.com | +46 704 86 14 92 #
> # ICQ: 63006462 | +46 8 694 82 22 #
> # PGP: http://www.mindbash.com/pgp/ #
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net