RE: [PHP-DB] array with two dimensions
There are really a few ways that you can solve this problem. I would use and associative array to do this. Making the array associative would work like this: $ALL_VALUES[$year] += $value; To retrieve the information back you would use the following loop: While($element = each($ALL_VALUES)) { echo $element[ key ]; //this would display the year echo $element[ value ]; //displays the value associated with the year } Hope that helps, I have tested it and it works for me Kelly Protsko -Original Message- From: Lars Rasmussen [mailto:[EMAIL PROTECTED]] Sent: February 17, 2003 8:28 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] array with two dimensions Hi all, Got a little problem here, I have a mysql query that looks like this SELECT SUM(value) as value, YEAR(dileveret) as year FROM table GROUP BY YEAR(dileveret) It works just fine, but i need to make a array that can could do somthing like this (know it doesent work) $ALL_VALUES[$year] += $value; The script is running the script up to 100 times to get all the specific data's, i hope that you know a way that i can hold the values, and year and later print one value for each year.. THANKS A LOT! Regards Lasse (newbie) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Receiving ARRAY from Forms
You could use sessions to pass the array to the next page easily. $_SESSION[arraylist] = $mList; Then just grab it back from the other form. If you haven't used sessions before you can get a quick overview here. http://www.theoutersphere.com/php/sessions.php Kelly -Original Message- From: Squirrel User [mailto:[EMAIL PROTECTED]] Sent: February 20, 2003 9:41 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Receiving ARRAY from Forms I tried the following code but all I get back is Array. I'm trying to pass a huge array. ? if( isset( $submit ) ) { echo array list:br; print_r( $eList ); $submit = ; } else { $mList = array(); $mList[0] = 1. hello; $mList[1] = 2. there; $mList[2] = 3. How are you; $fShow = EOD pPress Submit Button to test/p form method=POST action=$PHP_SELF name=Test Array pinput type=submit value=Submit name=submit input type=reset value=Reset name=B2/p input type=hidden name=eList[] value=$mList /form EOD; echo $fShow; } ? - This mail sent through ISOT. To find out more about ISOT, visit http://isot.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php/mysql query
Well if the zip codes have something in common just do a pattern match for them or are you just picking random zip codes? This way you only need one one sql statement to bring everything back. Kelly -Original Message- From: Julie Keywell [mailto:[EMAIL PROTECTED]] Sent: February 20, 2003 10:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] php/mysql query Hi there! I am querying our database for 11,000 different zip codes and it seems to be overloading MySQL. However, common sense says it shouldn't. My question is: When needing to query 11,000 things, is it best to make 1 SQL statement that has 11,000 ors, or run through individual querys 11,000 times? Any help would be wonderful! I am making PHP do the counting rather than MySQL. Thanks! Julie -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php