WE can easily manipulate our data from database in Joomla by using the below code. First need to call jfactory::getDBO$db = &JFactory::getDBO(); returns a reference for the database object in joomla.
For INSERT query in Joomla structure
$db = &JFactory::getDBO();
$insertquery = "INSERT into #__TABLENAME(feild1,feild2) values('value1','value2') ";
$db->setQuery( $insertquery );
$db->query();
For UPDATE query in Joomla structure
$updatequery = "UPDATE #__TABLENAME SET feild1 = 'value1' ";
$db->setQuery( $updatequery );
$db->query();
For DELETE query in Joomla structure
$deletequery = "DELETE FROM #__TABLENAME WHERE feild1 = 'value1' ";
$db->setQuery( $deletequery );
$db->query();
0 Comment(s)