Arrays
| From: | Phpu | Date: | Wed, 28 Apr 2004 09:11:39 +0000 |
| Subject: | Arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184859@lists.php.net to get a copy of this message | ||
I have a problem with arrays.
I have this script:
$query = "SELECT model_name, brand_name FROM products WHERE
product_id='$product_id'";
$result = mysql_query($query) or die("error in query - $query -".mysql_error());
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $element) {
$jelement[] = $element;
}
}
i want each element to be stored in a different array.
For ex: If i print now the array $jelement i have:
model_name1-brand_name1
model_name2-brand_name2
.........
I want 2 arrays: array1 will contain [model_name1,model_name2, ....] and array2
[brand_name1,brand_name2......]
How can i do that?
Thanks