Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

joomla database methods

How do I use in case of Joomla the mysqli bind_param

how would this example should be declared using joomla Database methods?

...
$statement->bind_param('s', $like);
$statement->execute();
like image 555
fefe Avatar asked Jun 14 '26 10:06

fefe


1 Answers

In Joomla! 3.1, PDO/Sqlite and PDO/Oracle are supporting prepared statements, others are not implemented yet.

Given using a 'preparable' connection, it would work this way:

$db    = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('...')->where('...');

$query->bind(':s', $like);

$db->setQuery($query);

$records = $db->loadObjectList();
like image 113
nibra Avatar answered Jun 17 '26 03:06

nibra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!