Hey guys i need to get the database column into a 1 mentionable array. Here is my code. [CODE] $spreadsql = "SELECT `categories_id` FROM `".$TABLES['CATEGORIES_SPREAD']."` WHERE `products_id` = '".$_REQUEST['pid']."'"; $spreadquery = mysql_query($spreadsql, $connection) or die ('Could not execute SQL query:<br />'.$sql.'<br /><strong>'.mysql_error().'</strong>'); $spread = mysql_fetch_assoc($spreadquery); $array = array(); foreach ($spread as $value) { $array[$x] = $value; $x++; } <?php do { ?> <input name="category[]" type="checkbox" value="" <?php print (in_array(readFromDB($categories['categories_id']), $categoriesspread)) ? 'checked="checked"' : '';?> /><?php print readFromDB($categories['category_title']); ?> | <?php print readFromDB($categories['categories_id']); ?><br /> <?php } while ($categories = mysql_fetch_assoc($catquery)); ?> [/CODE] I wan to then do a check for …

Member Avatar
Member Avatar
+0 forum 3

I'm trying to store the contents of a file containing names of herbs and spices (items) in a 2D array called PantryContents. Then I'm trying to add an item to that array. It seems like only one item is being stored at a time, but the output is correct but when I check the content of PantryContents, only one item shows up (like it's not 2D). This will be split into functions eventually.. (that's why the format is a little funky), I just needed to make it work all together first. Any ideas? This is what's in the file "Pantry.txt": …

Member Avatar
Member Avatar
+0 forum 2

Good morning, Can someone help me code this part of my assignment, it's been 24 hrs trying to do this. Place student names and final mark into two, one- dimensional arrays. One array will be of String (for names), the other will be an array for real numbers (for marks) Use the array to display: Class Average The number of students above the class average THANKS!

Member Avatar
Member Avatar
+0 forum 6

$a = array(000,400,000,500); $b = array(300,400,450,500); $i=0; foreach($b as $k=>$v) { if($v==$a[$i]) { $b[$k]='000'; } $i++; } print_r($b); i want same thing in two dimensional array $a = Array ( [0] => Array ( [0] => 000000 [1] => 000400 [2] => 000450 ) [1] => Array ( [0] => 000350 [1] => 000400 ) ) $b = array(0=>000350,1=>000400,2=>000450) //pre-defined installment amount values

Member Avatar
Member Avatar
+0 forum 4

Hi Everyone, I have a program that takes data in a two dimensional array, performs simple calculations, and then writes the data to a file. When I call the function that calculates and writes, I get an error on the two dimensional array stating: "argument of type 'int' is incompatible with parameter of type 'int(*)[5]'." .I am not sure why this suddenly changed to italics....ok but I am not sure why this error is happening. //Call writing function storeProportions(output, dropsOf[3][4], totals, numFailed); //located in main //Function prototype void storeProportions(ofstream output, int values[][NUM_COMPONENTS], int totals, int numRows); //2d array in main …

Member Avatar
Member Avatar
+0 forum 15

hii, guyz i wanted to learn how to declare and and use one and two dimensional array can any body give me a guidance through an eg.

Member Avatar
Member Avatar
+0 forum 2

Hello perhaps you could help me with a problem please. I wish to display a table of results using a JTable. Customarily I use a 2D Object array which is initialized with the data in a manner as follows: public Object[][] data={ {"Biology",25},{"Additional Math", 54},{"Geography",43},{"History",21},{"Spanish", 47}, {"Information Tech.",110},{"Technical Drawing",54},{"French",45},{"Physics",76},{"Chemistry",76}, {"Principles of Accounts",34},{"Principles of Business",30} }; However this time, initialising won't work because the data that I am receiving will be subject to change, thus the 2D array needs to be created at a later point. The added data that I will be receiving, will come from two(2) arrays, one containing …

Member Avatar
Member Avatar
+0 forum 2

**Tic-Tac-Toe without a class** Write a modular program that allows two players to play a game of tic–tac-toe. Use a two-dimensional char array with 3 rows and 3 columns as the game board. Each element of the array should be initialized with an asterisk(*). The program should display the intial board configuration and then start a loop that does the following. · Allow player 1 to select a location on the boardfor an X by entering a row and column number. Then redisplay the board with an X replacing * in the chosenlocation. · If there is no winner yet …

Member Avatar
Member Avatar
+0 forum 3

Hello, thanks for taking the time to read this. I'm working on (what should be) a simple, simple java program, I am very new to java so please bear with me. I'm writing code with a method that takes an array of int values and determines if all the numbers are different from each other, that they are distinct. Here is what I have so far: public class Array { public static void main(String[] args) { int[] numbers = {5, 10, 15, 20, 25, 1, 2}; System.out.println("Checking array to determine if all numbers are different: " + compareValues(numbers)); } public …

Member Avatar
Member Avatar
+0 forum 9

Hello, I need to write a program to take in a name (max 101 characters) and out store in into an array so that I can output it like a list. These 2 programs are apart of a bigger program that keeps asking if you want to add another name to the array but I can't seem to get the rows and colums matched in the program. I guess what I am trying to say is I can't make the output stop at the NULL character in the array. I need the output to say: *Current List: Mark Steve John* …

Member Avatar
Member Avatar
+0 forum 9

I am really in mess as I am unable to solve problem with Smarty Multi Dimension array. Below is the way I want to execute Smarty. First of all I will list all customers. Than I want list of all items purchased by that customer. I have two tables inside mysql (customer, sale). In Customer table only information related to his name and email is stored. While in sale table information related to item, price and customer is sold. Below is the way I will execute my smarty. John -Item1 -Item2 -Item3 David -Item5 -Item2 -Item7 In PHP File I …

Member Avatar
Member Avatar
+0 forum 1

I normally don't try to get outside help on homework that is still due, but I've kinda' hit a wall on this one. I'm trying to write a program that dynamically creates a list of scores for a group of students. It has to ask the user how many students (s)he wishes to process and how many tests scores there are to be. It then must dynamically create an array of structures for the student info and a second array to hold the test scores for each student. The instructions are very clear that the tests must be stored in …

Member Avatar
Member Avatar
+0 forum 4

I need to read a file that contains this: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 …

Member Avatar
Member Avatar
+0 forum 2

hi all, i have two three dimensional array like this [CODE] $array1 =Array ( [0]= array ( [0]=array ( [name]= praveen [id] = 20 ) [1]=array ( [name]= kumar [id] = 25 ) ) ) $array2 =Array ( [0]= array ( [0]=array ( [name]= pandu [id] = 21 ) [1]=array ( [name]= praveen [id] = 30 ) ) ) [/CODE] i want to merge these arrays such that i will get an array like this [CODE] $merged= array ( [0]= array ( [praveen]=array ( [id1]= 20 [id2] = 30 ) [pandu]=array ( [id] = 21 ) [kumar]=array ( [id] = …

Member Avatar
Member Avatar
+0 forum 3

Hello guys, I am trying to declare a two dimensional array in C++ on runtime. For this purpose I am asking the user about how many rows and columns should be created in the array. I have written the following code for this purpose. Apparently it is working just fine. But I am asking you if you can identify any mistake or error in this code especially in the memory deallocation part. Am I correctly releasing all the memory that I first allocated at the beginning of the program. Actually my course instructor touched this topic very slightly and also …

Member Avatar
Member Avatar
+0 forum 7

Hello all, I am currently a student doing an end-of-year software project - and I need some help. I am currently trying to return a 2D array from a function contained in a header file. The function is called from the main() and asks the user to input the location of the excel (.csv) file on the hard drive. Upon correctly inputting the file location, the program assigns values from the file into an array. The code is as follows: [CODE]#include <iostream> #include <sstream> #include <fstream> #include <vector> #include <string> using namespace std; //function to read in the user specified …

Member Avatar
Member Avatar
+0 forum 2

Trying to understand two dimensional vector and was wondering if anyone could help me out on a sorting code for this so that it numbers 0-9 people, gets x number with each of them and then outputs the person (number) ate x pancakes - But in descending or ascending order. [CODE] /* The vector seems right if my output works, this doesn't sort it though by person or pancake. */ vector< vector<int> > pVec(10,vector<int>(2)); for(int x=0; x < 10; x++){ pVec[x][0]= x; } sort(pVec[x][1].begin(), pVec[x][1].end()); for (int x = 0; x < pVec.size(); ++x) cout << "\nPerson "<< pVec[x][0] <<" …

Member Avatar
Member Avatar
+0 forum 7

Hi, I want to be able to sort a multidimensional array using its second dimension to sort the first. It is a list of sporting teams with points stored like this: [CODE]$teams[$teamnumber]['points'] $teams[$teamnumber]['players'] $teams[$teamnumber]['name'][/CODE] These teams are to be shown in a league table which is why they needed to be sorted in descending order of points, however the data must not be mismatched or teams may end up with the wrong name, players etc.

Member Avatar
Member Avatar
+0 forum 3

Ok, I have three main tasks. One: I need to create a 2 dimensional array that is 8x8 and consists of randomly generated numbers that range from 0-3. I'm assuming the Math.random will be used inside of a for loop with a limit set for length(8) and range(0-3) somehow? Two: This part is multi-pronged but the main thing I need to figure out is how to analyze the array once created. I need to print out if it finds at least 3 consecutive numbers in any row, column, diagonal, or subdiagonal(under a diagonal?). I would use a search but my …

Member Avatar
Member Avatar
+0 forum 16

I'm reading about two-dimensional and multi-dimensional arrays at the moment in order to better organize user input. I'm trying to create a function that can store a card player's hand. At the moment I'm just brainstorming how it would look and writing out some notes to myself to organize it in plain english before I break it down into C++. So far I've figured this: I'm going to use a two-dimensional array to store cards in a dealt hand. I figured it would have two columns, one to store the card's value and one for its suit. So something like …

Member Avatar
Member Avatar
+0 forum 3

Hello daniweb designers, I'm a programmer who is working with a mockup for a site I'm building. No, correction, I am a JUNIOR programmer. And I've never worked from a mockup before. I'm doing this particular build on my own for work. I've been able to get all parts of the file into working web page elements. The problem is that the original canvas size isn't sized for a website (I don't think...) It's 3333px x 2500px. And it doesn't size properly. I've tried changing the sizing in code but it skews the images which is obviously not going to …

Member Avatar
Member Avatar
+0 forum 2

Hi folks I'm trying to do my assignment in c++, I suppose to develope a maze traversal using backtracking algorithm. I have to write a constructor for my Maze with this sign. [CODE]Maze(**c, int size); [/CODE] which takes a n-by-n two-dimensional character array. Can you guide how can pass an array to this constructor? and how can I use it in the function? Cheers Ethan

Member Avatar
Member Avatar
+0 forum 4

The End.