v5:reference:connection:getone
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
reference:getone [2015/07/13 02:21] – created mnewnham | v5:reference:connection:getone [2021/03/11 20:15] (current) – [getOne] syntax: Added missing $bindvars param dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
+ | ~~NOTOC~~ | ||
<WRAP right box> | <WRAP right box> | ||
== Syntax == | == Syntax == | ||
mixed getOne( | mixed getOne( | ||
- | | + | |
+ | | ||
) | ) | ||
</ | </ | ||
+ | Executes the SQL and returns the first column of the first row. The recordset and remaining rows are discarded for you automatically. If an error occurs, either false or null is returned depending on the value of [[v5: | ||
- | Executes the SQL and returns the first field of the first row. The recordset and remaining rows are discarded for you automatically. If an error occur either false or null is returned depending on the value of $ADODB_GETONE_EOF. | + | You can use [[v5: |
===== Controlling the response if no records are found ===== | ===== Controlling the response if no records are found ===== | ||
- | By default, getOne returns NULL if no records are found. The global variable $ADODB_GETONE_EOF can be set to any value to indicate no match | + | By default, getOne returns NULL if no records are found. The global variable |
===== Usage ===== | ===== Usage ===== | ||
Line 28: | Line 31: | ||
print "No tickets have been sold in zip code 80111"; | print "No tickets have been sold in zip code 80111"; | ||
else | else | ||
- | print "The maximum number of tickets sold by arenas in Zip Code 80111 is $maxTickets"; | + | print "The maximum number of tickets sold by arenas |
+ | in Zip Code 80111 is $maxTickets"; | ||
</ | </ | ||
v5/reference/connection/getone.1436746881.txt.gz · Last modified: 2017/04/21 11:35 (external edit)