18
голосов
3ответов
50019 просмотров

PHP: Merge 2 Multidimensional Arrays

I need to merge 2 multidimensional arrays together to create a new array. The 2 arrays are created from $_POST and $_FILES and I need them to be associated with each other. Array #1 Array ( [0] => Array ( [0] => 123 [1] => "Title #1" [...

1
голосов
1ответов
348 просмотров

How can I use multidimensional arrays in PHP with MySQL-based sessions?

So I started using MySQL-based sessions with session_module_name("user"); and I love it, and I might as well because I have to. The only thing I'm missing are my beloved multidimensional arrays, and I'm at a juncture where they are most desired. How can I still use them, or is it a lost cause?

0
голосов
2ответов
950 просмотров

How to create a form for a 2D/multi-dimensional table?

I need to create a form in CakePHP to allow users enter data(numbers) into the cells shown on the table below. The input screen needs look like the table shown below. The users should be able to select any cell they want to enter/update the value, then type in the value, click submit and submit t...

3
голосов
3ответов
37584 просмотров

Looping a multidimensional array in php

I have a multidimensional array like this: array(2) { [1]=> array(3) { ["eventID"]=> string(1) "1" ["eventTitle"]=> string(7) "EVENT 1" ["artists"]=> array(3) { [4]=> array(2) { ["name"]=> string(8) "ARTIST 1" ["de...

0
голосов
3ответов
1266 просмотров

Display values of multidimensional array returend from function

function sitemap_galerija($tablica) { require("include/konekcija.php"); if($tablica == 'kategorije') { // Connect do database ... while($row = mysql_fetch_array($sql_result)) { $kategorija['naziv'][] = $row["naziv"]; $kategori...

0
голосов
1ответов
1451 просмотров

Simple formatting of multidimensional array from mysql in php

I have an array of results from mysql relational tables. It looks similar to this: array(10) { [0]=> object(stdClass)#14 (35) { ["eventID"]=> string(1) "1" ["eventTitle"]=> string(7) "EVENT 1" ["artistID"]=> string(1) "1" ["artistName"]=> stri...

2
голосов
6ответов
4908 просмотров

C++ Passing two dimensional arrays as parameters to classes

I've got a Car class and a Track class. The Car class constructor takes a road parameter which is supposed to be a 32x32 boolean array. Then I've got a Track class which creates a Car class and is supposed to pass the 32x32 array to it's constructor. Note that I've simplified the code somewhat...

0
голосов
2ответов
104 просмотров

PHP: modifying an array

Just need some help taking this hierarchical array... Array ( [root] => Array ([attr] => Array ([id] => 1) [label] => Array ([value] => My Root) [node] => Array ( [0] => Array ([attr] => Array([id] => 2) [label] => Array([value] =&g...

4
голосов
2ответов
9786 просмотров

How to read lines from a file into a multidimensional array (or an array of lists) in python

I have a file with a format similar to this: a,3,4,2,1 3,2,1,a,2 I want to read the file and create an array of lists in a way that: array[0] = ['a','3','4','2','1'] array[1] = ['3','2','1','a','2'] How can I do that? So far I am stuck with: f = open('./urls-eu.csv', 'r') for line in f: ...

0
голосов
1ответов
106 просмотров

PHP coding problem to get multiple instances from an array based on quantity variable within

I'm not sure if anyone can help me with a problem I have.. I have a parse function that includes the code: foreach ($values as $element) { $nodeName = $element["tag"]; switch ($element['type']) { case 'open': if ($nodeName == "SHOPPINGLIST") { $this->publicationID = $element["attributes"...

0
голосов
2ответов
1722 просмотров

multi dimensional char array?

What I am trying to do is create an 2-d array of character strings The following seg faults instantly, what is wrong? void add2(char***b, char *i) { if (!i) { b[0][0] = (char*) malloc(120); sprintf(b[0][0], "%s", "hithere"); b[0][1] = (char*) malloc(120); sprintf(...

0
голосов
2ответов
375 просмотров

determining the distance between points in n-dimensions

I am building a mySQL table listing points in n-dimensions, each dimension being indexed. Given any point in the n-dimensional system, I would like to be able to output all of the other points in order of their distance from the chosen point. A simple solution would be to calculate distances fr...

0
голосов
1ответов
293 просмотров

PHP multidimensional array

I have an array declared above the beginning of a for loop as: $array = array();. Now, in the for loop I start inserting values into it. At some point I make one of its index as another array as $array[$j]=array(); And insert some values like, $array[$j][$l] = id; and so on. Now, when I use pri...

0
голосов
5ответов
2106 просмотров

PHP - Foreach (Array of an Array)

Here is an example: for($i=1; $i < 10; $i++){ $marray[] = array($name, $email, $password); // Lets just say for now, there is real // data for each online being input } foreach ($marray as $e){ echo "Name: ". $e[0]; echo "Email: ". $e[1]...

0
голосов
2ответов
735 просмотров

How do I enumerate a multidimensional associative array?

I'll be the first to admit that PHP is not my forte and this array is starting to drive me nuts. This is the array I'm attempting to enumerate: // array containing the site menu $sitemap = array( array( 'Title' => 'menu01', 'Description' => 'menu01_description', 'Addr...

1
голосов
5ответов
1361 просмотров

What is the best way to manage array or arrays in classical ASP

PHP provides associative arrays but there is no such thing in classical asp. I am looking for a class or function that allows me to create and traverse a hierarchy similar to this: United States Washington Electric City Banks Lake Lake Chelan Wapato Point Gig Harbour ...

4
голосов
2ответов
6527 просмотров

How can I draw a "line" in a 2-D array (simulacrum for a screen)

I'm working on a project that's going to print out to a bitmap(more specifically a RAW, but that's not important to the question), but I'm working in a 2-D array in-program. I want to be able to draw a line from point (a,b) to point (x,y) for any arbitrary values of a,b,x, and y. I don't need a...

0
голосов
1ответов
2013 просмотров

SSAS 2008 Dimension Wizard and the Date Template

Does anyone know how to use the Date Template with the BIDS 2008, SSAS Project, Dimension Wizard? I keep getting an error - rightly so, I suppose - "Dimension not generated because it is bound to a time binding" (after having selected Generate a non-time table in the data source, in order to get ...

-1
голосов
2ответов
80 просмотров

Need help about array

What do $categories[$id] = array('name' => $name, 'children' => array()); and $categories[$parentId]['children'][] = array('id' => $id, 'name' => $name); mean? Thanks a lot.

116
голосов
20ответов
218430 просмотров

How to sum all column values in multi-dimensional array?

How can I add all the columnar values by associative key? Note that key sets are dynamic. Input array: Array ( [0] => Array ( [gozhi] => 2 [uzorong] => 1 [ngangla] => 4 [langthel] => 5 ) [1] => Array ...

0
голосов
3ответов
1341 просмотров

PHP Simple way to obtain value from multi level object

I know I can loop through each level of the object, but I would like a more simple approach to this. QueryResult Object ( [queryLocator] => [done] => 1 [records] => Array ( [0] => SObject Object ( [type] => type_...

0
голосов
3ответов
1699 просмотров

VB.Net - multi-column data variable object

I want to create an in-memory object in VB.Net with multiple columns. What I am trying to do is create an index of some data. It will look like: Row 1: 23 1 Row 2: 5 1 Row 3: 3 38 ... I know I can use a rectangular array to do this, but I want to be able to use indexOf opearations on this obje...

5
голосов
6ответов
1530 просмотров

Using dynamic multi-dimensional arrays in c++

I am making a C++ program that checks if given aray is a latin square. I need to use a dynamic multi-dimensional array that stores given latin square. But I cant pass the array to a function that does the checking... Currently I have such code for calling the function: int squaretest(int **p, i...

2
голосов
2ответов
2570 просмотров

Jquery atrr + 2D array issue

i have the following script and i can't find out how to use the value inside car[0]['img'] inside this $('#img2').attr('src',car[0]['img']); im a JS noob so please explain me .. why jquery wont accept the 2d array as string value and run the function , and whats the possible solution of my probl...

23
голосов
11ответов
37942 просмотров

Find all second level keys in multi-dimensional array in php

I want to generate a list of the second level of keys used. Each record does not contain all of the same keys. But I need to know what all of the keys are. array_keys() doesn't work, it only returns a list of numbers. Essentially the output Im looking for is: action, id, validate, Base, Ebase, ...

12
голосов
3ответов
2324 просмотров

What are the semantics of C99's "restrict" with regards to pointers to pointers?

I am doing lots of matrix arithmetic and would like to take advantage of C99's restrict pointer qualifier. I'd like to setup my matrices as pointers to pointers to allow for easy subscripting, like so: int **A = malloc (ncols * sizeof(int *)); A[0] = malloc (nrows * ncols * sizof(int)); for (in...

2
голосов
4ответов
2193 просмотров

column access with multidimensional array in php

I have a 2-D array of integers. I'd like to initialize it in column order, and then access it in row order. Is it possible to initialize in PHP in column order without explicitly iterating over every row? For example, in R, one can do my2d = matrix(nrow=2, ncol=2) # create 2x2 matrix my2d[,1] ...

5
голосов
2ответов
3316 просмотров

How to Find Dimension of a Multiple Dimension Array in C

I declared a 2-dimensional array like this: char *array[][3] = { {"a", "b", "c"}, {"d", "e", "f"}, {"u", "v", "w"}, {"x", "y", "z"}}; How do I find out the first dimension?

10
голосов
6ответов
6880 просмотров

How to convert all keys in a multi-dimenional array to snake_case?

I am trying to convert the keys of a multi-dimensional array from CamelCase to snake_case, with the added complication that some keys have an exclamation mark that I'd like removed. For example: $array = array( '!AccountNumber' => '00000000', 'Address' => array( '!Line1' => '10...

0
голосов
1ответов
278 просмотров

how to implement Multidimention array

I want to use a multidimensional array. Can any one explain how to use that in an iPhone app? I'm new to Objective-C. Here's what I'm trying to do: I am spliting the main string on the basis of seprator and storing in an array. replacing some content of this array's each elements with new sub...