Method queryCol
Executes query and returns the first column from the query result.
array $suSQL->queryCol(string query) array $suSQL->cache->queryCol(string query)
|
queryCol() sends a query to the currently active database on the server and returns the first column as
an array or empty array if no records were selected. You can cache query results by calling queryCol()
method via the cache class. The next time your block executes the same query SiteSupra will bring
back results from the cache instead of hitting the database. Refer to Using Cache for more information about
SiteSupra cache.
Examples
The script below prints out the first column of the query result.
<? $query = "SELECT * FROM test WHERE parent = 1"; $data = $suSQL->queryCol($query); print_r($data);
/* The output of print_r($data) will be: Array( [0] => 2 [1] => 3 [2] => 4 [3] => 5 ) */ ?>
|