Sponsored Content
Full Discussion: ksh arrays
Top Forums Shell Programming and Scripting ksh arrays Post 302763451 by Subbeh on Wednesday 30th of January 2013 04:21:34 AM
Old 01-30-2013
ksh arrays

Hi,

I have a ksh script in which I need to fill an array with a list of filenames.
It currently works like this:
Code:
set -A array \
  val1 \
  val2 \
  val3

However, I was wondering why it's not possible to do something like this to make it easier to parse values to the array:
Code:
set -A array <<EOF
  val1
  val2
  val3
EOF

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

KSH and arrays

hello all, I browsed the forum (briefly) and I am having issues with a script I writing. I need to check a directory and see if there are files there, if so process all of them. The issues I am having is that when I create the array of files names using set -A filenames "$(ls -1... (1 Reply)
Discussion started by: whited05
1 Replies

2. Shell Programming and Scripting

ksh script - arrays

hello all.. I have been browsing / searching through the forum and have yet not been able to find what I was looking for. I am fairly new to ksh and my task is to create a function that reads in an input file: ***************** 2 3 1 abc def ghi /dev/sid/ *****************... (13 Replies)
Discussion started by: sidamin810
13 Replies

3. Shell Programming and Scripting

Automatic Arrays in ksh

Given a line of text in ksh: string1 string2 string3 .....stringn is there a way of automatically assigning each string to an array element? Or just different variables would do. Thanks, Jon (1 Reply)
Discussion started by: Jonny2Vests
1 Replies

4. Shell Programming and Scripting

List of arrays in ksh?

Hi all, In a loop, i am creating an array of integer and adding it to another array that hold arrays // psuedo code pttrnArray=$type$data // This is array of integers. pttrnArrays=${pttrnArray} // This is supposed to be array of arrays. But when i print pttrnArrays, i get only the... (1 Reply)
Discussion started by: jakSun8
1 Replies

5. Shell Programming and Scripting

Export Arrays in ksh

Hello everybody! Why I can export arrays in ksh? I trie this for exemplo: In parent script array=a array=b array=c export array When I see the variable array in child script there are only first index. For exemplo in child script +echo ${array} a (3 Replies)
Discussion started by: ricardo.ludwig
3 Replies

6. UNIX for Dummies Questions & Answers

Arrays in nawk and ksh

I'm not confident at all on how arrays work. I want to know how to set arrays in ksh and in nawk (is there a difference??) if someone can show me some examples of both that will be great. Tried to look up on the net but was confusing me more. Any help would be appreciated. (2 Replies)
Discussion started by: Pablo_beezo
2 Replies

7. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

8. Shell Programming and Scripting

KSH: Reading a file line by line into multiple arrays

Hi - I have a file that contains data in this format:- #comment value1 value2 value3 #comment value4 value5 value6 value7 #comment value8 value9 I need to read value1, value2 and value3 into one array, value4 value5 value6 and value7 into another array and value8 and value9 into a 3rd... (2 Replies)
Discussion started by: sniper57
2 Replies

9. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

10. Shell Programming and Scripting

Multidimentional arrays in KSH

Hi, I am using KSH shell and need to define a multi dimensional array in which i need to store and retrive data. Please provide your valuable in puts. Eg: asbjkasd 1234 asdhnas 1254 i need to store the above values and use them as input to another command. Note each line is a pair. Thanks... (8 Replies)
Discussion started by: hraj1984
8 Replies
MYSQLI_STMT_EXECUTE(3)							 1						    MYSQLI_STMT_EXECUTE(3)

mysqli_stmt::execute - Executes a prepared Query

       Object oriented style

SYNOPSIS
bool mysqli_stmt::execute (void ) DESCRIPTION
Procedural style bool mysqli_stmt_execute (mysqli_stmt $stmt) Executes a query that has been previously prepared using the mysqli_prepare(3) function. When executed any parameter markers which exist will automatically be replaced with the appropriate data. If the statement is UPDATE, DELETE, or INSERT, the total number of affected rows can be determined by using the mysqli_stmt_affected_rows(3) function. Likewise, if the query yields a result set the mysqli_stmt_fetch(3) function is used. Note When using mysqli_stmt_execute(3), the mysqli_stmt_fetch(3) function must be used to fetch the data prior to performing any addi- tional queries. PARAMETERS
o $ stmt -Procedural style only: A statement identifier returned by mysqli_stmt_init(3). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCity LIKE City"); /* Prepare an insert statement */ $query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)"; $stmt = $mysqli->prepare($query); $stmt->bind_param("sss", $val1, $val2, $val3); $val1 = 'Stuttgart'; $val2 = 'DEU'; $val3 = 'Baden-Wuerttemberg'; /* Execute the statement */ $stmt->execute(); $val1 = 'Bordeaux'; $val2 = 'FRA'; $val3 = 'Aquitaine'; /* Execute the statement */ $stmt->execute(); /* close statement */ $stmt->close(); /* retrieve all rows from myCity */ $query = "SELECT Name, CountryCode, District FROM myCity"; if ($result = $mysqli->query($query)) { while ($row = $result->fetch_row()) { printf("%s (%s,%s) ", $row[0], $row[1], $row[2]); } /* free result set */ $result->close(); } /* remove table */ $mysqli->query("DROP TABLE myCity"); /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCity LIKE City"); /* Prepare an insert statement */ $query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)"; $stmt = mysqli_prepare($link, $query); mysqli_stmt_bind_param($stmt, "sss", $val1, $val2, $val3); $val1 = 'Stuttgart'; $val2 = 'DEU'; $val3 = 'Baden-Wuerttemberg'; /* Execute the statement */ mysqli_stmt_execute($stmt); $val1 = 'Bordeaux'; $val2 = 'FRA'; $val3 = 'Aquitaine'; /* Execute the statement */ mysqli_stmt_execute($stmt); /* close statement */ mysqli_stmt_close($stmt); /* retrieve all rows from myCity */ $query = "SELECT Name, CountryCode, District FROM myCity"; if ($result = mysqli_query($link, $query)) { while ($row = mysqli_fetch_row($result)) { printf("%s (%s,%s) ", $row[0], $row[1], $row[2]); } /* free result set */ mysqli_free_result($result); } /* remove table */ mysqli_query($link, "DROP TABLE myCity"); /* close connection */ mysqli_close($link); ?> The above examples will output: Stuttgart (DEU,Baden-Wuerttemberg) Bordeaux (FRA,Aquitaine) SEE ALSO
mysqli_prepare(3), mysqli_stmt_bind_param(3), mysqli_stmt_get_result(3). PHP Documentation Group MYSQLI_STMT_EXECUTE(3)
All times are GMT -4. The time now is 03:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy