Db fetch row: Difference between revisions From Online Manual

Jump to: navigation, search
(Created page with "{{smcfunc |function=db_fetch_row |usage=$smcFunc['db_fetch_row'] ($result) |description=return the exact same results as [http://php.net/mysql_fetch_row mysql_fetch_row]. Frequen...")
 
m (refresh SMW properties)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{smcfunc
{{smcfunc
|function=db_fetch_row
|function=db_fetch_row
|usage=$smcFunc['db_fetch_row'] ($result)
|order_position=3
|usage=$smcFunc['db_fetch_row'] (result)
|description=return the exact same results as [http://php.net/mysql_fetch_row mysql_fetch_row]. Frequently used when is known the query returns only one row of data.
|description=return the exact same results as [http://php.net/mysql_fetch_row mysql_fetch_row]. Frequently used when is known the query returns only one row of data.
|parameters={{parmdesc
|parameters={{parmdesc
   |$result|d1=a query resource as returned for example by [[db_query]]
   |result|d1=a query resource as returned for example by [[db_query]]
}}
}}
|return=an array of the values obtained from the query
|return=an array of the values obtained from the query
Line 15: Line 16:
list ($first_message, $last_message) = $smcFunc['db_fetch_row']($request);</nowiki>}}
list ($first_message, $last_message) = $smcFunc['db_fetch_row']($request);</nowiki>}}
}}
}}
<noinclude>
<noinclude>
[[Category:Database Functions]]
[[Category:Database Functions]]</noinclude>
[[Category:2.0]]
[[Category:Customizing SMF]]
[[Category:Developing SMF]]</noinclude>

Latest revision as of 16:39, 11 October 2012

Usage:

$smcFunc['db_fetch_row'] (result)


Description: return the exact same results as mysql_fetch_row. Frequently used when is known the query returns only one row of data.

Parameters:

  • result a query resource as returned for example by db_query

Return: an array of the values obtained from the query

Notes: emulated while using SQlite with smf_sqlite_fetch_row.

Example:

while ($row = $smcFunc['db_fetch_row']($request))
	$toDelete[] = $row[0];

Example using the function list:


list ($first_message, $last_message) = $smcFunc['db_fetch_row']($request);



Advertisement: