Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > SQLQuery class > Methods

SQLQuery class: addWhere

Scroll Prev Next More

 

If the current SQL query does not include a WHERE clause, addWhere() adds it as where($condition). Otherwise, the WHERE clause is added as a new condition: and($condition).

 

Note: SQLQuery class methods are used in the After table initialized event.

Syntax

addWhere($condition)

Arguments

$condition

any condition clause. Example: "id_sizes < 3 or id_sizes > 6". id_sizes is the name of the field.

Return value

No return value.

Example

Add a WHERE clause:

 

$query->addWhere("id_sizes < 3 or id_sizes > 6");
$query->addWhere("notes='".$_SESSION["UserID"]."'");
$query->addWhere("test ='passed'");

See also:

SQLQuery class: replaceWhere

Security: Additional WHERE tabs

Example: Dynamic SQL query

Event: AfterTableInit

About SQLQuery class

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software