ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:getone

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
reference:getone [2015/07/13 02:21] – created mnewnhamv5:reference:connection:getone [2021/03/11 20:15] (current) – [getOne] syntax: Added missing $bindvars param dregad
Line 1: Line 1:
-====== GetOne =====+====== getOne ===== 
 +~~NOTOC~~
  
 <WRAP right box> <WRAP right box>
 == Syntax == == Syntax ==
     mixed getOne(     mixed getOne(
-       string $sql+       string $sql
 +       optional string[] $bindvars
        )        )
  
 </WRAP> </WRAP>
    
 +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:reference:adodb_getone_eof]]. 
  
-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. use [[errorNo|errorNo()]] or[[ errorMsg|errorMsg()]] to get the error details. +You can use [[v5:reference:errormsg|errorMsg()]] to get any the error details. 
  
 ===== 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 ''$ADODB_GETONE_EOF'' can be set to any value to indicate no match
  
 ===== 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";
 </code> </code>
  
  
v5/reference/connection/getone.1436746881.txt.gz · Last modified: 2017/04/21 11:35 (external edit)