Tag Archives: Constructor

Constructor

PHP Database Form constructor takes three parameters. Use this method to create the PHP Database Form object. Usually this is the first line in your code.

Signature:

public function __constructor($sql, $sql_key='id', $sql_table='')

Parameters:

  • $sqlSQL SELECT statement. This is the only SQL statement users needs to implement. The SELECT statement must include the primary key as one of the columns if not using the wildcard start(*) in SELECT statement.
  • $sql_key: The name of the database table primary key. The default is “id”.
  • $sql_tableName of the database table used in the SQL statement. If not defined, the table name is automatically parsed from the SQL statement.

Example:

$dbForm = new C_DatabaseForm("SELECT * FROM employees", "EmployeeID", "employees");