[SQLResult Params]Found Items[/SQLResult]
Used to access info and result sets resulting from a [SQLExecute].

Example:


[SQLConnect dbType=MySQL&host=192.168.1.1&database=SMSITest&uid=sa&pwd=pass&conn_var=conn1]
Connected successfully<br>
[/SQLConnect]

[SQLExecute conn_ref=conn1&result_var=rs1]
select firstName,lastName from employees;
[/SQLExecute]

[SQLResult result_ref=rs1]
[numFound] records found<br>
<table border=1><tr><th>First Name</th><th>Last Name</th></tr>
[FoundItems]
<tr><td>[firstName]</td><td>[lastName]</td></tr>
[/FoundItems]
</table>
[/SQLResult]

Parameter Description
result_ref (or just 'ref')
(Required) - The name of the SQLResult variable you created with a prior execution of [SQLExecute] (the value you set for the "result_var" or "var" parameter)

The following tags are available inside a [SQLResult] context:
Tag Description
 [CommandText]
The SQL command string that was executed via the [SQLExecute] context.
 [NumFound]
A number indicating how many records were returned as the result of the SQL statemtnt (a 'select' staement in most cases). Some SQL statements will not result in a record set, i.e. DELETE, INSERT, DROP, etc... In these cases [numfound] will be zero.
 [NumFields]
A number indicating the number of fields in the returned record set.
 [NumRowsAffected]
The number of rows changed by an INSERT/UPDATE/DELETE command.
 [InsertID]
The insert ID of a successfull INSERT command.
[FoundItems]...[/FoundItems]
Normally you put a [FoundItems] loop inside a [SQLResult] context to retrieve the records resulting from a SQL SELECT statement, so you can display all the matching records. You can put any record set field name inside the [FoundItems] loop to display them in HTML. There are other SQL commands that will return a records set. For example, in MySQL, the following statements will return a record set:
"show tables;"
"show processlist;"
"describe <table>;"

It may sometimes be the case when you will not know all or any of the field names returned in a record set. Executing 'Select * from mytable' will pull all field values into the record set, but will you *know* what those field names are? If not, you can use the [ListFields] context to iterate the field names of a result set.
For example:


[SQLConnect dbType=MySQL&host=192.168.1.1&database=SMSITest&uid=sa&pwd=pass&conn_var=conn1]
[/SQLConnect]

[SQLExecute conn_ref=conn1&result_var=rs1]
select * from employees;
[/SQLExecute]

[SQLResult result_ref=rs1]
[numFound] records found<br>
<table border=1>
<tr>
[ListFields]<th>[fieldname]</th>[/ListFields]
</tr>
[FoundItems]
<tr>
[ListFields]<td>[interpret][[fieldname]][/interpret]</td>[/ListFields]
</tr>
[/FoundItems]
</table>
[/SQLResult]

You can also use the new [Field], inside [FoundItems], to retrieve field data by the fields position in the records set.
For example:


[SQLConnect dbType=MySQL&host=192.168.1.1&database=SMSITest&uid=sa&pwd=pass&conn_var=conn1]
[/SQLConnect]

[SQLExecute conn_ref=conn1&result_var=rs1]
select * from employees; 
[/SQLExecute]

[SQLResult result_ref=rs1]
[FoundItems]
[loop start=1&end=[numFields]]
[field seek=ordinal:[index]&get=NAME]: <b>[field seek=ordinal:[index]&get=VALUE]</b> [hideif [index]=[numfields]]- [/hideif]
[/loop]<br>
[/FoundItems]
[/SQLResult]