I create an item id in k2 using BF, how do I know the new id number of the item?

  • Colombiamed
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0

Colombiamed replied the topic: I create an item id in k2 using BF, how do I know the new id number of the item?

Thanks
It didn't work either.

$tag= '';

$db = JFactory::getDbo();
$id = $db->insertid();

foreach($rule As $item){
if( $item[_FF_DATA_NAME] == 'Depar' ){ // the actual field name
$tag= $item[_FF_DATA_VALUE];
break;
}
}

if($id && $tag != ''){

$sql = "INSERT INTO `#__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL ".$db->quote($tag) .",".$db->quote( $id ) ." )";

$db->setQuery($sql);
$db->execute();
}

How can I debug the code?
I want it shows a message after

if($id && $tag != ''){

And I also want to know the value of $id and $tag
#241140
  • Posts: 8405
  • Karma: 164
  • Thank you received: 669

TheMuffinMan replied the topic: I create an item id in k2 using BF, how do I know the new id number of the item?

Try this (before the if-statement):
echo "ID: ". $id."<br/>";
echo "TAG: " . $tag."<br/>";
exit;

if($id && $tag != ''){

Regards,
Markus

===========================
If you are happy, please leave us a small review here to keep us motivated:
(Please turn off your VPN and local Apache prior reviewing as your review might get blocked)

⭐⭐⭐⭐⭐ BreezingForms: extensions.joomla.org/extension/contacts...orms/breezing-forms/
⭐⭐⭐⭐⭐ ContentBuilder: extensions.joomla.org/extension/authorin...tion/contentbuilder/

===========================
Satisfied?
Get a membership!
===========================
#241163
Moderators: ForumSupport
Time to create page: 0.046 seconds

We Are Doing Our Part

Massive discounts on all of our extension subscription plans to help you and your business in these times.

Get Your Subscription Here

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

We are doing our part and support your business with extremely low prices -- For example 6-Months-Subscription for only $9 USD. For as long as necessary.

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!