Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqlite_fetch_single(3) [php man page]

SQLITE_FETCH_SINGLE(3)													    SQLITE_FETCH_SINGLE(3)

sqlite_fetch_single - Fetches the first column of a result set as a string

SYNOPSIS
string sqlite_fetch_single (resource $result, [bool $decode_binary = true]) DESCRIPTION
Object oriented style (method): string SQLiteResult::fetchSingle ([bool $decode_binary = true]) string SQLiteUnbuffered::fetchSingle ([bool $decode_binary = true]) sqlite_fetch_single(3) is identical to sqlite_fetch_array(3) except that it returns the value of the first column of the rowset. This is the most optimal way to retrieve data when you are only interested in the values from a single column of data. PARAMETERS
o $result - The SQLite result resource. This parameter is not required when using the object-oriented method. o $decode_binary -When the $decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the sqlite_escape_string(3). You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications. RETURN VALUES
Returns the first column value, as a string. EXAMPLES
Example #1 A sqlite_fetch_single(3) example <?php if ($dbhandle = sqlite_open('mysqlitedb', 0666, $sqliteerror)) { $sql = "SELECT id FROM sometable WHERE id = 42"; $res = sqlite_query($dbhandle, $sql); if (sqlite_num_rows($res) > 0) { echo sqlite_fetch_single($res); // 42 } sqlite_close($dbhandle); } ?> SEE ALSO
sqlite_fetch_array(3). PHP Documentation Group SQLITE_FETCH_SINGLE(3)

Check Out this Related Man Page

SQLITE_COLUMN(3)														  SQLITE_COLUMN(3)

sqlite_column - Fetches a column from the current row of a result set

SYNOPSIS
mixed sqlite_column (resource $result, mixed $index_or_name, [bool $decode_binary = true]) DESCRIPTION
mixed SQLiteResult::column (mixed $index_or_name, [bool $decode_binary = true]) mixed SQLiteUnbuffered::column (mixed $index_or_name, [bool $decode_binary = true]) Fetches the value of a column named $index_or_name (if it is a string), or of the ordinal column numbered $index_or_name (if it is an integer) from the current row of the query result handle $result. PARAMETERS
o $result - The SQLite result resource. This parameter is not required when using the object-oriented method. o $index_or_name - The column index or name to fetch. o $decode_binary -When the $decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the sqlite_escape_string(3). You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications. RETURN VALUES
Returns the column value. NOTES
Note Use this function when you are iterating a large result set with many columns, or with columns that contain large amounts of data. SEE ALSO
sqlite_fetch_string(3). PHP Documentation Group SQLITE_COLUMN(3)
Man Page

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to retrieve sql result to unix....

Hi, i would like to retrieve seql result and write it into unix text file like "result.txt" In unix, normally, I type "sql" and get into sql,then type "select....." to run and get the result....then copy and paste into result.txt any possible way to write a script to run it automatically?... (3 Replies)
Discussion started by: happyv
3 Replies

2. Shell Programming and Scripting

help:Reading width separated data

Hi, I'm quite new to unix script, and is having some problems currently. Say for the following sample project: The sql result is stored in a file >sql.txt. The result is shown (sample table): ID Price Tag Name ----- ------- ----- -------- A 100 test1 test1 B ... (6 Replies)
Discussion started by: lornen81
6 Replies

3. Shell Programming and Scripting

scripting issue

Hello, Guys I am having a sql script file which contains some sql statements including inserting values, One column is of the data type date. Now i am having a KSH script for inserting values via this script into the database. The problem I am facing that when I am inserting value in the... (1 Reply)
Discussion started by: mraghunandanan
1 Replies

4. Shell Programming and Scripting

find and replace a string in a file without the use of temp file

Hi - I am looking for a replacing a string in a in multiple *.sql files in directory with a new string without using a temporary file Normally I can use sed command as below for W in ls `FILE*.sql` do sed 's/OLD/NEW/g' $W > TEMPFILE.dat mv TEMPFILE.dat $W done But Here in my... (9 Replies)
Discussion started by: raghutapal
9 Replies

5. Programming

how to output data with only an specific string on it

hi! i made an sql script but i do not know how to just output all the lines that starts with an specific string. and that string, you will input it before i run the sql for example: INPUT NAME: JOHN i just want to output lines that starts with JOHN (2 Replies)
Discussion started by: engr.jay
2 Replies

6. UNIX for Dummies Questions & Answers

Hot to retrieve *.sql file names which we refer in .sh file.

Hi Guys, How to retrieve/get *.sql file names which we refer in all *.sh files. Can any one help me on this. Thanks, Kolipaka (3 Replies)
Discussion started by: lakshmanrk811
3 Replies