Solar_Sql_Select::having()

public Solar_Sql_Select Solar_Sql_Select::having ( string $cond , string $val = '--5a333dc50d9341d8e73e56e2ba591b87' )

Adds a HAVING condition to the query by AND.

Parameters

  • (string) $cond: The HAVING condition.

  • (string) $val: A value to quote into the condition.

Returns

  • (Solar_Sql_Select)

Description

Adds a HAVING condition to the query by AND.

If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears.

Array values are quoted and comma-separated.

<?php
// simplest but non-secure
$select->having("COUNT(id) = $count");

// secure
$select->having('COUNT(id) = ?', $count);

// equivalent security with named binding
$select->having('COUNT(id) = :count');
$select->bind('count', $count);


Local