This function is introduced in the later section ???Working with Binary Data.???
For example, suppose you retrieved all rows from the employees table. Using this
function, you could selectively poll columns, like so:
$sqldb = sqlite_open("corporate.db");
$results = sqlite_query($sqldb,"SELECT * FROM employees WHERE empid = '1'");
$name = sqlite_column($results,"name");
$empid = sqlite_column($results,"empid");
echo "Name: $name (Employee ID: $empid)
";
sqlite_close($sqldb);
?>
This returns the following:
Name: Jason Gilmore (Employee ID: 1)
Ideally, you??™ll want to use this function when you??™re working either with result sets
consisting of numerous columns or with particularly large columns.
Retrieving the First Column in the Result Set
The sqlite_fetch_single() function operates identically to sql_fetch_array() except
that it returns just the value located in the first column of the result set. Its prototype
follows:
string sqlite_fetch_single(resource row_set [, int result_type
[, bool decode_binary]])
?– Tip This function has an alias: sqlite_fetch_string(). Except for the name, it??™s identical in
every way.
Consider an example. Suppose you??™re interested in querying the database for a
single column. To reduce otherwise unnecessary overhead, you should opt to use
sqlite_fetch_single() over sqlite_fetch_array(), like so:
580 CHAPTER 22 ?– SQLITE
$sqldb = sqlite_open("corporate.
Pages:
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665