webCOMAND

#SQLDB

Syntax

#SQLDB(Type,Host,Name,Username,Password) ... #ENDSQLDB

Parameters

  • Type - The database type.  Options include:
    • mysql - MySQL or MariaDB
    • oci - Oracle
    • odbc - ODBC v3 (ie. Microsoft SQL Server, IBM DB2)
    • pgsql - PostgreSQL
    • sqlite - SQLite
  • Host - "localhost" when the database is hosted on the same server, otherwise the hostname or IP address of the remote server.
  • Name - Name of the database
  • Username - Username to access the database.
  • Password - Password to access the database.

Description

Sets the database all #SQL statements will query inside the #SQLDB block.

Related: #SQL

Example

#SQLDB("mysql","localhost","address_book","user","pass")
#SQL($Results,"SELECT Name FROM contacts")
#LIST($Results)
$Name<br />
#ENDLIST
#ENDSQLDB

Result

The example above might produce the following output.

John Smith<br />
Mary Joe<br />