Solar_Sql_Select::where()

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

Adds a WHERE condition to the query by AND.

Parameters

  • (string) $cond: The WHERE condition.

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

Returns

  • (Solar_Sql_Select)

Description

Adds a WHERE 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->where("id = $id");

// secure
$select->where('id = ?', $id);

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


Local