Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Displaying multiple variables in for loop Post 302982320 by reindeermountai on Wednesday 28th of September 2016 04:02:42 AM
Old 09-28-2016
Ok! Thanks!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

for loop with multiple variables ?

I have a script which selects two 'sets' of system LVM device files from a tabular file 'mapfile' using awk : LIVELV=`awk '{print($1)}' mapfile` BCVLV=`awk '{print($3)}' mapfile` I wanted to pass these 'sets' into an LVM command 'loop' along the lines of : lvmerge $BCVLV $LIVELV ie.... (3 Replies)
Discussion started by: fosterian
3 Replies

2. Shell Programming and Scripting

While loop with Multiple variables

Hi , I am trying to write a script in kshell with while loop ,its like count=1 count_cmp=1 while ; do tail -$count tempfile | head -1 > tempstring ....... done However i get CIF.sh: line 33: ' I have checked thetrailing spaces , not sure what is... (4 Replies)
Discussion started by: amit1_x
4 Replies

3. UNIX for Dummies Questions & Answers

multiple variables in for loop

hi, I want an equivalent for loop for this C code in unix shell script... for(int i,int j;i<5;i++,j++) { } Please reply soon Regards Navjot (1 Reply)
Discussion started by: navjotsingh
1 Replies

4. Shell Programming and Scripting

setting and displaying variables

Hello, I need a little help. 1. Edit /etc/profile so that all users are greeted upon login. 2. For the root account, set the prompt to something like "Danger!! root is doing stuff in \w", preferably in a bright color such as red or pink or in reverse video mode. Thanks for help. (4 Replies)
Discussion started by: zhshqzyc
4 Replies

5. Shell Programming and Scripting

How to use for/while loop with multiple variables?

Hi, I have two variables like below which will always be of the same size a=1:2:3 b=A:B:C I need to use a for/while loop that will have both the variables available. I cannot use an array here and will probably might iterate through the variable as echo $a | tr ':' '\n' and thus iterate... (5 Replies)
Discussion started by: Elizabeth H
5 Replies

6. UNIX for Dummies Questions & Answers

Multiple variables to be passed in a loop

Hi, I need to pass the multiple values of src1 to another variable. I managed to print it but not sure how to assign it to a variable in a loop. src1=01,02,03 echo $src1|awk 'BEGIN {FS=","} {for(i=1;i<=NF;i++) print $i}' I need to pass the value as src2=01 src2=02 src2=03 Thanks... (4 Replies)
Discussion started by: shash
4 Replies

7. UNIX for Dummies Questions & Answers

Reading multiple variables in a loop

Hi, I managed to read and print variable as shown in the below code. table_name=table1,table2,table3 i=0 IFS="," for i in $table_name do echo $i done Is there a way how I can read more than one variable. For example I need to read 2 variables and populate the output... (6 Replies)
Discussion started by: shash
6 Replies

8. Shell Programming and Scripting

Loop with multiple delimited variables

hi, i need a portion in a audit logging shell script where i have to loop thru multiple variables. I need some help in accomplishing this. i have 3 variables var1=1,23,234 var2=a,ab,xyz var3=0,0,0 the variables will have variables number of values but same length.(3 in this case ) i... (10 Replies)
Discussion started by: rock1
10 Replies

9. Shell Programming and Scripting

Multiple variables using awk and for loop for web form submission

Hi My goal is to fill an HTML form and submit. What I have managed to do: 1. curl command to fill up the form and submit 2. a file which has the input curl command: curl -v -b cookie.txt -d __CSRFToken__=dc23d5da47953b3b390ec68d972af10380908b14 -d do=create -d a=open -d... (10 Replies)
Discussion started by: zorrox
10 Replies
CUBRID_QUERY(3) 							 1							   CUBRID_QUERY(3)

cubrid_query - Send a CUBRID query

SYNOPSIS
resource cubrid_query (string $query, [resource $conn_identifier]) DESCRIPTION
cubrid_query(3) sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified $conn_identifier. PARAMETERS
o $query - An SQL query Data inside the query should be properly escaped. o $conn_identifier - The CUBRID connection. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is assumed. RETURN VALUES
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, cubrid_query(3) returns a resource on success, or FALSE on error. For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, cubrid_query(3) returns TRUE on success or FALSE on error. The returned result resource should be passed to cubrid_fetch_array(3), and other functions for dealing with result tables, to access the returned data. Use cubrid_num_rows(3) to find out how many rows were returned for a SELECT statement or cubrid_affected_rows(3) to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement. cubrid_query(3) will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query. EXAMPLES
Example #1 Invalid Query The following query is syntactically invalid, so cubrid_query(3) fails and returns FALSE. <?php $conn = cubrid_connect('localhost', 33000, 'demodb'); $result = cubrid_query('SELECT * WHERE 1=1'); if (!$result) { die('Invalid query: ' . cubrid_error()); } ?> Example #2 Valid Query The following query is valid, so cubrid_query(3) returns a resource. <?php // This could be supplied by a user, for example $firstname = 'fred'; $lastname = 'fox'; $conn = cubrid_connect('localhost', 33000, 'demodb'); cubrid_execute($conn,"DROP TABLE if exists friends"); cubrid_execute($conn,"create table friends(firstname varchar,lastname varchar,address char(24),age int)"); cubrid_execute($conn,"insert into friends values('fred','fox','home-1','20')"); cubrid_execute($conn,"insert into friends values('blue','cat','home-2','21')"); // Formulate Query // This is the best way to perform an SQL query // For more examples, see cubrid_real_escape_string() $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'", cubrid_real_escape_string($firstname), cubrid_real_escape_string($lastname)); // Perform Query $result = cubrid_query($query); // Check result // This shows the actual query sent to CUBRID, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . cubrid_error() . " "; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the cubrid result functions must be used // See also cubrid_result(), cubrid_fetch_array(), cubrid_fetch_row(), etc. while ($row = cubrid_fetch_assoc($result)) { echo $row['firstname']; echo $row['lastname']; echo $row['address']; echo $row['age']; } // Free the resources associated with the result set // This is done automatically at the end of the script cubrid_free_result($result); ?> SEE ALSO
cubrid_connect(3), cubrid_error(3), cubrid_real_escape_string(3), cubrid_result(3), cubrid_fetch_assoc(3), cubrid_unbuffered_query(3). PHP Documentation Group CUBRID_QUERY(3)
All times are GMT -4. The time now is 02:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy