2

I have a following table and I want to know how to write the inset query using JDatabaseQuery in Joomla.

jos_esolutions_movies - table name
id, name, description, status - field names
1 , 'ABC' , 'ABC description', 0 - example values
halfer
  • 19,824
  • 17
  • 99
  • 186
Sara
  • 14,098
  • 13
  • 34
  • 50

3 Answers3

5
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->insert('#__tablename');
$query->set("field1='values1', field2='values2'");
$db->setQuery($query);
$db->query();
Gaurav
  • 28,447
  • 8
  • 50
  • 80
0

the following link will help you to create a joomla database query http://docs.joomla.org/How_to_use_the_database_classes_in_your_script

jogesh_pi
  • 9,762
  • 4
  • 37
  • 65
  • I want to write query using a method see this http://docs.joomla.org/API16:JDatabaseQuery – Sara Jan 10 '12 at 08:27
0
$db =& JFactory::getDBO();
$query = "insert into #__esolutions_movies (id, name, description, status) values(1 , 'ABC' , 'ABC description', 0)";
$db->setQuery($query);
$db->query();