Sponsored Content
Full Discussion: Concatenate Strings
Top Forums Web Development Concatenate Strings Post 302593142 by Jeneca on Wednesday 25th of January 2012 08:22:57 PM
Old 01-25-2012
Concatenate Strings

hi..Smilie
this is my sample part of my program..
Code:
    $csv_output .= $row['name'].",".
                                   $row['region'].",".
                                   $row['city'].",".
                                   $row['Area'].",".
                                   $row['Street'].",".
                                   $row['Building'].",".
                                   $row['totalorders'].",".
                                   $row['totalgross'].","."\n";

and the output of this is..
Code:
name, region,city,area,street,building,totalorders,totalgross

now the output that I need is like this..
Code:
"name","region","city","area","street","building","totalorders","totalgross"

is there anybody can help me how can I make this output..?
thanks in advanced.
have a great day ahead. Smilie
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to concatenate two strings or several strings into one string in B-shell?

like connect "summer" and "winter" to "summerwinter"? Can anybody help me? thanks a lot. (2 Replies)
Discussion started by: fontana
2 Replies

2. UNIX for Dummies Questions & Answers

Concatenate Strings

Hi Friends, I have a requirement I need to concatenate the below two strings. String 1 = /@jobid_at_ String 2 = value stored in ORACLE_SID String 3 = string1 concatenated with String 2. Please let me know how should i do it in UNIX. Thanks, (2 Replies)
Discussion started by: diva_thilak
2 Replies

3. Shell Programming and Scripting

delete repeated strings (tags) in a line and concatenate corresponding words

Hello friends! Each line of my input file has this format: word<TAB>tag1<blankspace>lemma<TAB>tag2<blankspace>lemma ... <TAB>tag3<blankspace>lemma Of this file I need to eliminate all the repeated tags (of the same word) in a line, as in the example here below, but conserving both (all) the... (2 Replies)
Discussion started by: mjomba
2 Replies

4. UNIX for Dummies Questions & Answers

concatenate strings

if i use echo "ravi" echo "sankar" it showing output ravi sankar but i want output as ravi sankar remember sankar should be in another echo statement only (2 Replies)
Discussion started by: shankr3
2 Replies

5. Shell Programming and Scripting

Concatenate text between patterns in individual strings

In any given file, wherever a certain data block exists I need to concatenate the values(text after each "=" sign) from that block. in that block. The block starts and ends with specific pattern, say BEGIN DS and END DS respectively. The block size may vary. A file will have multiple such blocks.... (12 Replies)
Discussion started by: Prev
12 Replies

6. Programming

Concatenate two strings

Hello! Can anyone explain line 28 for me? I was thinking *a would be replaced by *b, but it actually appends *a to *b. I know it is related to pointer address, but could not figure it out by myself. Thanks a lot! 1 //Concatenate two strings 2 3 #include<stdio.h> 4 char *stradd (char *,... (5 Replies)
Discussion started by: yifangt
5 Replies

7. Shell Programming and Scripting

Concatenate strings

Hi,I'm trying to concatenate @example.com to each line of a file f1.txt. and push it into f2.txt. Here is the code i'm using. for i in `cat /home/linux1/xxxxxxx/f1.txt`; do echo ${i}@example.com > /home/linux1/xxxxxx/f2.txt; done But above code only printing @example.com in f2.txt. what... (18 Replies)
Discussion started by: sam_bd
18 Replies

8. UNIX for Dummies Questions & Answers

Concatenate strings in a a for loop

hi guys, I have this question. I am creating an script to that read a text file(.ini) with the list of the patterns to find for example: EPMS_VO EMPS_PARTS Then it check if file have been delivered in a folder and process it with each pattern, but I am having problems concatenting the... (7 Replies)
Discussion started by: Danman
7 Replies
MAXDB_FETCH_ARRAY(3)							 1						      MAXDB_FETCH_ARRAY(3)

maxdb_fetch_array - Fetch a result row as an associative, a numeric array, or both

       Procedural style

SYNOPSIS
mixed maxdb_fetch_array (resource $result, [int $resulttype]) DESCRIPTION
Object oriented style mixed maxdb_result::fetch_array ([int $resulttype]) Returns an array that corresponds to the fetched row or NULL if there are no more rows for the resultset represented by the $result param- eter. maxdb_fetch_array(3) is an extended version of the maxdb_fetch_row(3) function. In addition to storing the data in the numeric indices of the result array, the maxdb_fetch_array(3) function can also store the data in associative indices, using the field names of the result set as keys. Note Field names returned by this function are case-sensitive. Note This function sets NULL fields to the PHP NULL value. If two or more columns of the result have the same field names, the last column will take precedence and overwrite the earlier data. In order to access multiple columns with the same name, the numerically indexed version of the row must be used. The optional second argument $resulttype is a constant indicating what type of array should be produced from the current row data. The possible values for this parameter are the constants MAXDB_ASSOC, MAXDB_ASSOC_UPPER, MAXDB_ASSOC_LOWER, MAXDB_NUM, or MAXDB_BOTH. By default the maxdb_fetch_array(3) function will assume MAXDB_BOTH, which is a combination of MAXDB_NUM and MAXDB_ASSOC for this parameter. By using the MAXDB_ASSOC constant this function will behave identically to the maxdb_fetch_assoc(3), while MAXDB_NUM will behave identi- cally to the maxdb_fetch_row(3) function. The final option MAXDB_BOTH will create a single array with the attributes of both. By using the MAXDB_ASSOC_UPPER constant, the behaviour of this function is identical to the use of MAXDB_ASSOC except the array index of a column is the fieldname in upper case. By using the MAXDB_ASSOC_LOWER constant, the behaviour of this function is identical to the use of MAXDB_ASSOC except the array index of a column is the fieldname in lower case. RETURN VALUES
Returns an array that corresponds to the fetched row or NULL if there are no more rows in resultset. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT name, state FROM hotel.city ORDER by zip"; $result = $maxdb->query($query); /* numeric array */ $row = $result->fetch_array(MAXDB_NUM); printf ("%s (%s) ", $row[0], $row[1]); /* associative array */ $row = $result->fetch_array(MAXDB_ASSOC); printf ("%s (%s) ", $row["NAME"], $row["STATE"]); /* associative and numeric array */ $row = $result->fetch_array(MAXDB_BOTH); printf ("%s (%s) ", $row[0], $row["STATE"]); /* free result set */ $result->close(); /* close connection */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT name, state FROM hotel.city ORDER by zip"; $result = maxdb_query($link, $query); /* numeric array */ $row = maxdb_fetch_array($result, MAXDB_NUM); printf ("%s (%s) ", $row[0], $row[1]); /* associative array */ $row = maxdb_fetch_array($result, MAXDB_ASSOC); printf ("%s (%s) ", $row["NAME"], $row["STATE"]); /* associative and numeric array */ $row = maxdb_fetch_array($result, MAXDB_BOTH); printf ("%s (%s) ", $row[0], $row["STATE"]); /* free result set */ maxdb_free_result($result); /* close connection */ maxdb_close($link); ?> The above example will output something similar to: New York (NY) New York (NY) Long Island (NY) SEE ALSO
maxdb_fetch_assoc(3), maxdb_fetch_row(3), maxdb_fetch_resource(3). PHP Documentation Group MAXDB_FETCH_ARRAY(3)
All times are GMT -4. The time now is 02:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy