• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: problem with INSERT in $_POST

problem with INSERT in $_POST 13 years 2 months ago #12772

  • mm
  • mm's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hi i'm trying to create simple form that will create new record in database. My code is:
$userId = $_POST['form']['user_id'][0];
$db =& JFactory::getDBO(); 
 
$db->setQuery("DELETE FROM `jos_mmt_userwspolnota` WHERE `user_id` = '". $userId ."'");
$db->query();
 
$db->setQuery("DELETE FROM `jos_fua_userindex` WHERE `user_id` = '". $userId ."'");
$db->query();
 
$db->setQuery("INSERT INTO `jos_fua_userindex` (`user_id`,`group_id`) VALUES ('". $userId ."', (SELECT `fua_id` FROM `jos_mmt_userwspolnota` LEFT JOIN `jos_mmt_wspolnota` ON `jos_mmt_userwspolnota`.`wspolnota_id` = `jos_mmt_wspolnota`.`id` WHERE `user_id` = '". $userId ."' LIMIT 0 , 1))"
$db->query();

but only DELETE works, INSERT does not. I tried with quite simple insert INSERT INTO table (fields) VALUES (xyz) without variables but it is not working either.

Please help
The administrator has disabled public write access.

Re:problem with INSERT in $_POST 13 years 2 months ago #12775

  • mm
  • mm's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
ignore it :) my mistake. Error was in query.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!