php-db | 2002091
Date: 09/02/02
- Next message: :B nerdy: "[PHP-DB] [mysql] freeing resources"
- Previous message: victor: "[PHP-DB] RE: [PHP] help, array values echoed as Array on loop!"
- In reply to: victor: "[PHP-DB] RE: [PHP] help, array values echoed as Array on loop!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ok, wrong mailing list!
- Victor > www.argilent.com
-----Original Message-----
From: victor [mailto:siliconhype <email protected>]
Sent: Monday, September 02, 2002 3:46 PM
To: php-db <email protected>
Subject: [PHP-DB] RE: [PHP] help, array values echoed as Array on loop!
Ok, if I change $ID_arr[] to $ID_arr I think it gives me what I want.
- Victor > www.argilent.com
-----Original Message-----
From: Victor [mailto:victor <email protected>]
Sent: Monday, September 02, 2002 3:39 PM
To: 'PHP'
Subject: [PHP] help, array values echoed as Array on loop!
I have tried both ways to loop through an array and output the data and
verify that the array is an array and I get no erros but I get this
value, which should not be so.
Here I'm checking if it's an array:
if (!is_array($ID_arr)) { # show error if no array
echo '$ID_arr is not an array.';
}
here I'm counting the keys but it only outputs as 1:
$key = count($ID_arr);
echo $key;
here are two loops that do the same thing and they both output Array:
for($i = 0; $i < count($ID_arr); $i++) {
echo $ID_arr[$i];
}
foreach($ID_arr as $ind_picture) {
echo $ind_picture;
}
Why? If it helps, in order to get the array, the values were taken from
a database and exploded from a coma delimited string.
$ID_arr[] = explode(',', $pictures); # make db data into array
This is the string:
15,16,17,18,19
I want each array element to contain
=> 15
=> 16
=> 17
etc...
why does it echo as Array?
- Victor > www.argilent.com
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: :B nerdy: "[PHP-DB] [mysql] freeing resources"
- Previous message: victor: "[PHP-DB] RE: [PHP] help, array values echoed as Array on loop!"
- In reply to: victor: "[PHP-DB] RE: [PHP] help, array values echoed as Array on loop!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

