joomla database methods

落花浮王杯 提交于 2019-12-18 08:55:00

问题


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:


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


来源:https://stackoverflow.com/questions/15812065/joomla-database-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!