joomla database methods

2020-02-14 06:38发布

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();

1条回答
淡お忘
2楼-- · 2020-02-14 07:01

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();
查看更多
登录 后发表回答