Accessing the database using JDatabase

From Joomla! Documentation

Revision as of 00:53, 16 March 2009 by Yuanming (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Can anyone provide more info regarding insertObject()? I just have no idea of how to insert a row into a table. I tried to do the following but it just doesn't work:

$db = & JFactory::getDBO(); $query = "insert into #__my_table(field1, field2) values ('".$value1."','".$value2."')"; echo $query; $db->setQuery( $query ); return($db->Query());

Any ideas?