35 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for rsleventhal

At times, I have need to push all submitted form array values into $_SESSION. To do this, I've written a small function: function addPostToSession() { foreach ($_POST as $key=>$value ){ $_SESSION[$key]=stripslashes(strval($value)); } } This works well, as long as $_POST is one dimensional, but in a form with checkboxes, $_POST …

Member Avatar for cereal
0
394
Member Avatar for diafol

Hi all. Have been racking my brains about how to go about creating a multidimensional array dynamically from an array of keys. Something like... $keys = array('key1', 'key2', 'key3'); $value = 'some value'; // $md = ...???!!!... I need the $md multidimensional array to have the keys thus... $md['key1']['key2']['key3'] = …

Member Avatar for Webville312
0
9K
Member Avatar for theashman88

So I'm basically trying to recreate the simulation of two dice being rolled, and I need to count the frequency in a two dimensional rectangular array, then display the array. I'm so lost I wrote some code but it didn't work, can anyone help. This is the assignment I'm not …

Member Avatar for cgeier
0
434
Member Avatar for CJMW

So im making an RPG. For collision detection, I thought I would do it like this: 1. Read text file containing collision data. 2. Iterate through the list using nested for loops. 3. When a value of 1 occurs (denoting an inpassable tile) add a rectangle to list 'badTiles', where …

Member Avatar for CJMW
0
411
Member Avatar for CJMW

So, Im making a game in c# using Xna. I have a function that will read a text file and display a map on screen, using numbers in the file as texture references. The file is a integer multidimensional array. I have another file which is used to set collision …

Member Avatar for CJMW
0
383
Member Avatar for PerplexedB

Please consider the following class : <?php class p0110dbinsertbuilder { public $table=""; private $fields ; public function add($Field,$Value){ $this->fields = array($Field,$Value); } public function insertstring(){ $count = count($this->fields,0); $c = "INSERT INTO " . $this->table . "("; for ($i=0;$i<$count;$i++){ $c .= $this->fields[$i][0]; if ($i <> $count-1){ $c .= ","; } …

Member Avatar for PerplexedB
0
219
Member Avatar for bazingatheory

hi i am really new to this and can't see why i can't get my code to work, it is probily really silly but help would be appreciated. i am trying to get the user to enter the number of competators of a 4 lap race so that it can …

Member Avatar for Moschops
0
330
Member Avatar for rexdon

//Give me an example for Serialising Multidimensional array in c sharp. //While searching in net i found this code snippet [XmlIgnore] public char[,] Data; [XmlElement("Data")] [EditorBrowsable(EditorBrowsableState.Never)] public char[][] XmlData { get { /* copy contents of Data into a jagged array */ } set { /* copy contents of jagged …

Member Avatar for deceptikon
0
980
Member Avatar for LinDoc

Hi! I am learning C, and am at very introductory level, using this book called C Programming: A Modern Approach. I have just studied about arrays, and while tackling the programming exercises,i got stuck in Que 9 in Chapter 8. This is what the question says [INDENT]Write a program that …

Member Avatar for pizFunk
0
2K
Member Avatar for cussel

>Hi guys,..i've two arrray data1 and data2 then i do intersect to get same value between data1 and data2, and >use count to get total same value,..how to ARSORT count result from intersect array multidimensional? <?php $data1 = array( array( '7' => 'chelsea everton', '8' => 'everton villa', '9' => …

Member Avatar for broj1
0
329
Member Avatar for cussel

>hi guys, how to get first and last (key and value) array multidimesional below? $data1 = array( array( '0'=>array( '7'=>'chelsea', '8'=>'everton', '9'=>'villa', '10'=>'liverpool' ), array( '23'=>'milan', '24'=>'inter', '25'=>'juventus', ), ), '1'=>array( array( '53'=>'madrid', '54'=>'barcelona', '55'=>'altetico', '56'=>'everton', ), array( '243'=>'milan', '244'=>'inter', '245'=>'juventus', ), ), '2'=>array( array( '523'=>'madrid', '524'=>'barcelona', '525'=>'altetico', '526'=>'everton', ), …

Member Avatar for diafol
0
383
Member Avatar for Mike_H

I have the following code in my **PHP** program: $query = "SELECT * FROM board_members"; $result = mysql_query($query) or die(mysql_error()); $data = array(); // create a variable to hold the information while (($row = mysql_fetch_array($result, MYSQL_ASSOC)) !== false){ $data[] = $row; // add the row in to the results (data) …

Member Avatar for Mike_H
0
251
Member Avatar for NuGG

I have an array of file names which gets split into 3's using array_chunk, then using array_push "X" is added to each array chunk. I now want to to reassemble the array chunks into one "2D" array. I have been playing around with array_merge, but I can only get the …

Member Avatar for NuGG
0
487
Member Avatar for rhguh

I am working on a project that requires a CSV file to be read into a multidimensional array. I loop through the array, and set multidimensionalarray[x][n] to the corresponding data in the CSV file, but I keep getting IndexError: list index out of range. I can't figure out why, and …

Member Avatar for rhguh
0
290
Member Avatar for omnia456

I have this example php string: [CODE]$string = "@[item_1][door] @[mozart][grass] = yes @[mozart][green] = no @[mozart][human] @[blue][movie]=yes @[item_1][beat] = yes @[item_1][music] = no ";[/CODE] now $string idented just to easy view: [CODE]@[item_1][door] @[mozart][grass] = yes @[mozart][green] = no @[mozart][human] @[blue][movie]=yes @[item_1][beat] = yes @[item_1][music] = no[/CODE] I want to know …

Member Avatar for pritaeas
0
262
Member Avatar for nyuszi

Hi i need a little help. i want to read a multi array from a file but code blocks said a lots of error and i dont know whats the problem. can u help me? [ICODE]#include <iostream> #include <cstdlib> #include <math.h> #include <fstream> #include <sstream> using namespace std; int maxn=100; …

Member Avatar for nyuszi
0
256
Member Avatar for aru211285

Dear All, I have created a multi dimensional array and stored elements in that through while loop like $human = array(); and at every iteration the while loop will add elements like $human["IPI"]["Description"][] = $row; $human["IPI"]["link"][]= $link; but when i wanted to print this array contents in a table format …

Member Avatar for diafol
0
503
Member Avatar for atfOnly

Hello people :) i'm trying to insert query result into 2 dimensional array i have tried the following way.. [CODE] $query=mysql_query("..."); while($row=mysql_fetch_array($query)){ for($i=0;$i<=$index;$i++){ if(isset($myarray[$i]['array1'])|| isset($myarray[$i]['array2'])){ array_unshift($myarray[$i]['array1'],$row['study_period']); array_unshift($myarray[$i]['array2'],$row['test']); }//endif }//endfor }//endwhile [/CODE] But, it failed i also tried.. [CODE] $query=mysql_query("..."); while($row=mysql_fetch_array($query)){ $myarray=array( array("array1"=>$row['study_period'],"array2"=>$row['test']) ); }//endwhile [/CODE] it failed too since it …

Member Avatar for atfOnly
0
256
Member Avatar for atfOnly

Hello all! :) Do you have any link on some complete reference on multidimensional array in php?? Please tell me.. thanks a lot.

Member Avatar for atfOnly
0
169
Member Avatar for bunny07

Hi, I'm new to this forum and C#. I try to make an array that each is the sum of the value of each row in sims array. It gives me nothing but zero. Please help. TIA. [CODE]public double[] ave_S(int M, int N, double S, double sig, double dt, double[,] …

Member Avatar for bunny07
0
176
Member Avatar for GregPeters

Hi all I was wondering how to pass a multidimensional array to a function: Here is my code: [CODE] #include <cstdlib> #include <iostream> using namespace std; void PrintArray (int* array, int n); int main(){ int SIZE; cout << "Enter how many records: "; cin >> SIZE; int array[SIZE][2]; for (int …

Member Avatar for txwooley
0
227
Member Avatar for Splam Bub

Hello DaniWeb! I'm trying to return an array of strings from a function but I'm not sure how to do so. I've done the prerequisite Googling and have found people on this discussion board recommending to return char** which, it is said, can then be converted back into 2d array …

Member Avatar for Splam Bub
0
152
Member Avatar for FumarMata

Hello I want to pass a bidimensional vector to the constructor of all instances of [ICODE]MyClass[/ICODE]. All instances must use and share and modify the same vector. And I want to keep a reference to that [ICODE]main_vector[/ICODE] to use it later in the program I am passing it by reference …

Member Avatar for Fbody
0
199
Member Avatar for techie1991

I was trying to code the assembly line sheduling problem using the dynamic programming approach. I have coded the program but i am facing problem with the 2-dimensional arrays I am using. For testing purpose, I wanted to initialize the array, but I was not able to get it. Moreover, …

Member Avatar for Fbody
0
203
Member Avatar for mike_2000_17

Hey y'all, I have been working on a tensor library (Nth-order multi-dimensional arrays) and I've been having trouble coming up with a good scheme for a multi-dimensional iterator template. Basically, I have a class template "tensor_container" which stores all the values of the N-order array (as a std::vector of one …

Member Avatar for mike_2000_17
0
247
Member Avatar for ceatkin2

I am trying to define a 2D array of 1000 by 1000 ints and then test which transversal method is faster (row major or column major). I have this written [CODE] #include <stdio.h> #include <time.h> int main() { clock_t start, end; double elapsed; start=clock(); int array[1000][1000]; int row, col; for(row=0; …

Member Avatar for ceatkin2
0
164
Member Avatar for TinhornAdeniyi

I cant figure out what is wrong with this code These are the instructions [ATTACH]17304[/ATTACH] [ATTACH]17305[/ATTACH] [ATTACH]17306[/ATTACH] and this is my code [CODE]#include<iostream> #include<fstream> #include<iomanip> using namespace std; void Get_Info(string[],int[][3]); void Get_Average(int[][3]); void Prt_GradeBook(string[],int[][3],int[]); int MakeUps(int[][3]); int Grades[5][3],average[5]; string Students[5]; int main() { Get_Info(Students,Grades); Get_Average(Grades); Prt_GradeBook(Students,Grades,average); cout<<"There are"<<MakeUps(Grades)<<"Makeup(s) to arrange. …

Member Avatar for VernonDozier
0
187
Member Avatar for newprimitive

Hello, In OOP PHP, i got 2 classes: Database and News. In News class i call DB function and get result (multidimensional 2D array). Now i have to display that array in index.php. I call News class (lets say get_news() function) from index.php but cant retrieve data and always get …

Member Avatar for Stefano Mtangoo
0
153
Member Avatar for altf4

I have written a program that will generate a random maze and solve it. The program uses a multidimensional array of a class that holds bool values for each wall, whether or not to show an * for the path taken, and if it is a dead end. here is …

Member Avatar for mrnutty
0
187
Member Avatar for Griff0527

I am trying to create a code that receives up to 50 integers from the keyboard, sorts the array from largest to smallest, then counts the instances of each number and displays the number inputted and the count of the number of instances. For example, if the number 11 was …

Member Avatar for NathanOliver
0
1K

The End.