Support Center

Please check docs.livewhale.com for the most up-to-date LiveWhale CMS and LiveWhale Calendar documentation. The below legacy documentation will remain available as a reference until the documentation migration is complete.

Escaping Values (SQL)

Last Updated: Nov 25, 2015 10:46AM PST

We all know how important is it to protect the integrity of a database by escaping values being utilized in SQL requests. You may also make use of LiveWhale’s built in escape method $_LW->escape() by passing subsequent arguments to applicable methods. The structure is very flexible.

// as a single parameter
$_LW->dbo->where('foo=?',$foo);

// params as an array
$_LW->dbo->where('foo=?',array($foo));

//arrays for both
// use an array for multiples
​$_LW->dbo->where('foo=? AND bar=?', array($foo, $bar));
$_LW->dbo->where(array('foo'=>'?'),array($foo));