Home  >  Article  >  php教程  >  Joomla database operation sample code

Joomla database operation sample code

高洛峰
高洛峰Original
2016-12-27 13:37:211048browse

The examples in this article describe the methods of joomla database operation. Share it with everyone for your reference, the details are as follows:

1, jTable

$row =& JTable::getInstance('comment', 'Table');
$row->load($id);
$row->bind(JRequest::get('post'))
$row->store()

2, jModel

$this->_db->setQuery($query);
$this->_db->loadObject();
$this->_getList($query, 0, 0);

3, jFactory

$db =& JFactory::getDBO();
$query = "SELECT count(*) FROM #__reviews";
$db->setQuery( $query );
$total = $db->loadResult();
$query = "SELECT * FROM #__reviews";
$db->setQuery( $query,$limitstart, $limit );
$rows = $db->loadObjectList();

I hope this article will be helpful to everyone’s PHP programming based on joomla.

For more joomla database operation sample code related articles, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn