Previous Page
quote()

Solar_Sql_Adapter_Mysql
quoteInto()

Next Page
quoteMulti()

quoteInto()

public mixed quoteInto ( string $txt, mixed $val )

Quotes a value and places into a piece of text at a placeholder.

Inherited from Solar_Sql_Adapter.

Parameters

  • (string) $txt: The text with a placeholder.
  • (mixed) $val: The value to quote.

Returns

  • (mixed) An SQL-safe quoted value (or string of separated values) placed into the orignal text.

Description

Quotes a value and places into a piece of text at a placeholder.

The placeholder is a question-mark; all placeholders will be replaced with the quoted value. For example ...

<?php
$sql = Solar::factory('Solar_Sql');

$text = "WHERE date < ?";
$date = "2005-01-02";
$safe = $sql->quoteInto($text, $date);

// $safe == "WHERE date < '2005-01-02'"
?>