DECLARATION:
-in general, a multidimensional array definition can be written as..
data-type variable-name [subscript1][subscript2]
ex. int cards[4][12];
------------------------------------
INITIALIZATION:
-like the one-dimensional arrays, they can be initialized on their definition
-the syntax underscores that it is an array of arrays
ex. int cards[4][12] = { {arg1, arg2,...argn}, {arg1, arg2,...argn} };
-only size of the first dimension can be excluded
ex. float matrix [][3] = { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} };
------------------------------------
PROCESSING:
-still, operations must be carried out on an element-by-element basis.
ex.1
matrix[0][0] = 1.0;
matrix[0][1] = 0.0;
matrix[0][2] = 1.0;
ex.2
for(i=0; o<3; i++){
for(j=0; j<3; j++){
printf("%f", matrix[i][j]);
}
printf("\n");
}
Wednesday, February 24, 2010
Wednesday, February 10, 2010
PHP: functions
In this tutorial I will show some helpful codes where you can get the data from the SQL using a the PHP
SELECT * FROM table1 WHERE column1 LIKE '%a';
-displays all the data that ends with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE '%a%';
-displays all the data with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE 'a%';
-displays all the data that starts with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE '_ _ _ _';
-displays all the data but limits the displayed data to only 4 characters
SELECT * FROM table1 WHERE column1 IN ("an", "be", "cy");
-displays all the data that starts with 'an', 'be' and 'cy'
SELECT * FROM table1 ORDER BY name;
-displays all the data but sorted by its 'name'
SELECT * FROM table1 LIMIT 20;
-displays only the first 20 data
SELECT COUNT(*) FROM table1 WHERE column1 = 'asdf';
-displays the number of data that have 'asdf' entry
SELECT MAX(column1) FROM table1;
-determine what data have the highest entry
SELECT * FROM table1 WHERE column1 LIKE '%a';
-displays all the data that ends with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE '%a%';
-displays all the data with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE 'a%';
-displays all the data that starts with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE '_ _ _ _';
-displays all the data but limits the displayed data to only 4 characters
SELECT * FROM table1 WHERE column1 IN ("an", "be", "cy");
-displays all the data that starts with 'an', 'be' and 'cy'
SELECT * FROM table1 ORDER BY name;
-displays all the data but sorted by its 'name'
SELECT * FROM table1 LIMIT 20;
-displays only the first 20 data
SELECT COUNT(*) FROM table1 WHERE column1 = 'asdf';
-displays the number of data that have 'asdf' entry
SELECT MAX(column1) FROM table1;
-determine what data have the highest entry
Sunday, February 7, 2010
PHP: Parsing string to integer
(int)$var
(int) the way to convert a string to integer
$var the sample variable
Subscribe to:
Posts (Atom)
