Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mssql_fetch_assoc(3) [php man page]

MSSQL_FETCH_ASSOC(3)													      MSSQL_FETCH_ASSOC(3)

mssql_fetch_assoc - Returns an associative array of the current row in the result

SYNOPSIS
array mssql_fetch_assoc (resource $result_id) DESCRIPTION
Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mssql_fetch_assoc(3) is equiv- alent to calling mssql_fetch_array(3) with MSSQL_ASSOC for the optional second parameter. PARAMETERS
o $result_id - The result resource that is being evaluated. This result comes from a call to mssql_query(3). RETURN VALUES
Returns an associative array that corresponds to the fetched row, or FALSE if there are no more rows. EXAMPLES
Example #1 mssql_fetch_assoc(3) example <?php // Send a select query to MSSQL $query = mssql_query('SELECT [username], [name] FROM [php].[dbo].[userlist]'); // Check if there were any records if (!mssql_num_rows($query)) { echo 'No records found'; } else { // Print a nice list of users in the format of: // * name (username) echo '<ul>'; while ($row = mssql_fetch_assoc($query)) { echo '<li>' . $row['name'] . ' (' . $row['username'] . ')</li>'; } echo '</ul>'; } // Free the query result mssql_free_result($query); ?> PHP Documentation Group MSSQL_FETCH_ASSOC(3)

Check Out this Related Man Page

MSSQL_FIELD_NAME(3)													       MSSQL_FIELD_NAME(3)

mssql_field_name - Get the name of a field

SYNOPSIS
string mssql_field_name (resource $result, [int $offset = -1]) DESCRIPTION
Returns the name of field no. $offset in $result. PARAMETERS
o $result - The result resource that is being evaluated. This result comes from a call to mssql_query(3). o $offset - The field offset, starts at 0. If omitted, the current field is used. RETURN VALUES
The name of the specified field index on success or FALSE on failure. EXAMPLES
Example #1 mssql_field_name(3) example <?php // Send a select query to MSSQL $query = mssql_query('SELECT [username], [name], [email] FROM [php].[dbo].[userlist]'); echo 'Result set contains the following field(s):', PHP_EOL; // Dump all field names in result for ($i = 0; $i < mssql_num_fields($query); ++$i) { echo ' - ' . mssql_field_name($query, $i), PHP_EOL; } // Free the query result mssql_free_result($query); ?> The above example will output something similar to: Result set contains the following field(s): - username - name - email SEE ALSO
mssql_field_length(3), mssql_field_type(3). PHP Documentation Group MSSQL_FIELD_NAME(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to find n'th row from UNIX file?

Hello Gurus, I am new to this forum and I have a BASIC knowlege in UNIX commands. I have a data file which contains 1 billion records, how to find 5678th row and put this rows into a new file? Can anybody please give the command how to do this? (3 Replies)
Discussion started by: nvkuriseti
3 Replies

2. Shell Programming and Scripting

duplicating 1st row of data

Hi, I have data in the following format: data1 data2 data3 data4 data5 data6 data7 data8 data9 data10 I require the final output to be: data1 data1 data1 data1 i only require the 1st line but I need to replicate it in n rows where n is the number of rows where data... (4 Replies)
Discussion started by: ReV
4 Replies

3. Shell Programming and Scripting

Writing records from resultset to file

Hi Friends, can you help me with this I would like to write records from a query into a flat file? I am currently using this code Is there any other method ??? sqlplus -s username/password <<- ! select * from emp_db; quit ! > sample.txt Thanks in advance. Thanks Sam :) (3 Replies)
Discussion started by: sbasetty
3 Replies

4. Shell Programming and Scripting

manipulating csv to add extra row

hi how do i manipulate .csv file to add an extra row after each row using shell script? I need a blank line added for each 1000 records in my file? I will then need to copy and paste some data in the blank row created. thanks 4 ur support neil (3 Replies)
Discussion started by: neil546
3 Replies

5. Shell Programming and Scripting

Displaying the data from the select query in a particular format

Hi, I have a shell script that returns 10 records for the column Name and age from a select query. Where when i store those data in retrieve_list.txt file i need to store the data in a particular format like:- $Jason$30 $Bill$23 $Roshan$25 Here is my script: 1)... (15 Replies)
Discussion started by: sachin.tendulka
15 Replies

6. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

7. Shell Programming and Scripting

Shell quiz: emulate an associative array

Most shells flavors do not have associative arrays a.k.a. maps. How would you emulate an associative array? I had this problem once and found a working solution, but I don't want to spoil the game hence I wont tell it. Wonder if anyone comes up with something better. (5 Replies)
Discussion started by: colemar
5 Replies

8. Shell Programming and Scripting

Simple scripting.

echo "what is your username?" read username echo $username echo /home/$username $backup="backup" $restore="restore" # # if then echo "No username provided" else echo "hi $username would you like to backup or restore?" read userrequest echo $userrequest if then ... (4 Replies)
Discussion started by: EwanD
4 Replies

9. Shell Programming and Scripting

row Comparison

(5 Replies)
Discussion started by: number10
5 Replies

10. Programming

Populating Associate Arrays in PHP

I'm not very good at associative arrays; and working on this PHP code has got me a bit stumped. My goal is to populate a (multidimensional) associative array in a PHP while look after a MySQL query. The code fragment looks like this: while($campaign_row = mysql_fetch_array($campaigninfo)) { ... (9 Replies)
Discussion started by: Neo
9 Replies

11. Shell Programming and Scripting

shell script for saving oracle database records in variable

i want to retrieve value in each column of each row in sql plus and save them into array variable and echo the value in array variable (2 Replies)
Discussion started by: ramish
2 Replies

12. Shell Programming and Scripting

Print list to row using awk

Hello, can somebody help me on this please. I have a list of numbers and I want to print them in one line seprated by a comma except the last one using awk 34 12 56 76 88 output 34,12,56,76,88 Thanks Sara (15 Replies)
Discussion started by: Sara_84
15 Replies

13. Shell Programming and Scripting

Removing specific records from files when duplicate key

Hello I have been trying to remove a row from a file which has the same first three columns as another row - I have tried lots of different combinations of suggestion on this forum but can't get it exactly right. what I have is 900 - 1000 = 0 900 - 1000 = 2562 1000 - 1100 = 0 1000 - 1100... (7 Replies)
Discussion started by: tinytimmay
7 Replies

14. Shell Programming and Scripting

Deleting redirected pwd from file.

Hi echo " username " read username echo "password" stty -echo read password stty echo through read i am taking standard input and redirecign them to a file echo " username=${username}/${password} " > file.lst now from the same shell script i want to delete the password (i.e... (4 Replies)
Discussion started by: rosheks
4 Replies

15. Shell Programming and Scripting

To extract query from a text file.

Hi, I've a txt file with the following contents: variable = "select name, emp_id, org_name " variable = variable + " from table_name where " variable = variable + " condition_1 = ABC and " variable = variable + " condition_2 = DEF " varaible = variable + " order by other condition " ... (7 Replies)
Discussion started by: arjun_arippa
7 Replies