arrays

PHP - How to send an array to another page ?

Hello, I'm trying to send an array to another page. What I tryed before was: page1 <input type='hidden' name='input_name' value='<?php print_r($array_name); ?>' /> And page2 <?php $passed_array = $_POST['input_name']; ?> Now how do I make $passed_array act like an array? Or do you know of any other way of solving this problem? ...

Array Manipulation in C++

Help me understand this piece of code - After the first iteration the value of PlcCode becomes A1*. How come? Shouldn't it be A*? Code = "A1"; char Wild = '*'; TDataString PlcCode(Code); for (int i = (Code.Len() - 1); i >= 0; i--) { PlcCode[i] = Wild; } ...

Simple formatting of multidimensional array from mysql in php

Hello. 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"]=> string(8) "ARTIST 1" ["artistDescription"]=> s...

Getting "conflicting types for function" in C, why?

Hello, I'm using the below code: char dest[5]; char src[5] = "test"; printf("String: %s\n", do_something(dest, src)); char *do_something(char *dest, const char *src) { return dest; } The implementation of do_something is not important here. When I try to compile the above I get these two exception: "error: conflicting types for 'd...

How to declare a C Array as a property of an Objective-C object?

I'm having trouble declaring a C Array as an Objective-C Property (You know @property, and @synthesize so I can use dot syntax)...Its just a 3 dimensional int array.. ...

Maximum index size for array

Hello, The following code is crashing my program. I found the problem is the size of the array. If I reduce the size to 320*320, it works fine. Does it make sense that this wound be a limitation? If so, what is a work around? I am coding in Objective C for IPhone. Any help would be appreciated. Thanks! int life_matrix[320*350];...

Array optimization: what is more expensive?

Which of the following pieces of code is more expensive? x = my_array.inject {|sum,i| int+=i } or x = eval(my_array.join('+')) ...

How to use string index in c++ arrays(like php)?

How to use string index in c++ arrays(like php)? ...

How to declare C array of strings

I'm working on a simple lex program for class, and in it I'm creating a very rudimentary symbol table, just an array of strings with a linear scan for search. I've declared it as: char* identifiers[100]; And I'm using it like so: found = false; for (i = 0; i < seen_identifiers; i++) { if (!strcmp(identifiers[i], yytext)) { ...

Can the attributes of a class be an array?

I'm new to OOP, so please bear with me if this is a simple question. If I create a class, which has attributes "a", "b", and "c", is it possible for the attributes to be an array, such that attribute a[2] has a meaning? ...

Looping a multidimensional array in php

Hi! 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" ["description"]=> string(13) "artist 1 desc" ...

What is difference between array and ArrayList?

I have a doubt that what is an array and what is an ArrayList? What is the different between them? ...

php function to return sql results that contain arrays, as an array

So im having a problem (obviously). I have the following MySQL table data 7 USER1 1,1,1,10,1 The Guys Team 8,7,13,14,16 8 USER1 1,1,1,10,1 The Girls Team 7,12,15 10 USER1 1,1,1,10,1 Dog Team 8,7,14,15 I wrote a function to retrieve the data, and return it. function ShowSetTeams($coach){ $result = mysql_query("...

Compare array attributes

I would like to compare two array items with php, I think I should use array_intersect_key but I don't know how I can do that. Array 1 [1] =&gt; obj Object ( [idobj:protected] =&gt; 2 ) [2] =&gt; obj Object ( [idobj:protected] =&gt; 1 ) Array 2 [1] =&gt; obj Object ...

'Undefined' Notice while populating arrays

While populating an array with data from a SimpleXML call, PHP throws exception to what it believes as 'Undefined' keys, however, the output is actually correct. $doc = new SimpleXmlElement($http_result, LIBXML_NOCDATA); $result = array(); $x = 0; foreach($doc->users->user as $item) { $result['user'][$x]['id'] .= $item->id; $...

Unique entries in an array

Hi, I have the following that stores the previous 10 URL's into a session: function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pag...

parse json array wich contains sql array

Hello, I am still searching for an answer but I haven't come up with a solution yet My question: How can I parse the json array I send it like this $data= mysql_fetch_array($r); header('Content-type: application/json'); ?> { "check": "<?php echo $check?>", "productcode": "<?php echo $code?>", "values": [<?php ech...

What are some shorthand (but not neccessarily safe) ways of displaying arrays in PHP?

I have tried to do this: <?=implode(array('A','B','C')); To display an array but was wondering if there was an easier way of showing an array? I tried <?=print_r(array('A','B','C')); But it actually displays an array structure. I want the string to be like ABC. ...

Calculating Moving Range in SQL Server (without arrays)

Hi, I have a requirement to calculate the Moving Range of a load of data (at least I think this is what it is called) in SQL Server. This would be easy if I could use arrays, but I understand this is not possible for MS SQL, so wonder if anyone had a suggestion. To give you an idea of what I need: Lets say I have the following in a sql...

Help with PHP web page

I have a webpage that has a roster for World of Warcraft on it. I would like to know how do I create summary statistics for number of each Class, number of each Race, and number of each Gender. Can someone please help. The data is read in from an XML page into an array. Thank you. ...