Jump to content

Put data in table field


Harmen
 Share

Recommended Posts

Hello,

 

I want to put some data in a table field, but if I put the label of the first table field, it gives an error:  Item 'feature' set to TableRows is not an allowed type

Here is my code:

	foreach ($fetchAll as $fetch => $feature) {
						$productid = $feature["id_product"];
						$pages = wire("pages")->get("productid=$productid");
						$pages->of(false);  // ensure output formatting is off
						$pages->Specification->feature = ($feature['name']);
						$pages->Specification->value = ($feature['value']);
						$pages->save();
					}

I tried to give the label other names, but it still doesn't work. How can this be solved?

Link to comment
Share on other sites

Have you read the API instructions for adding rows to tables in the Profields Table support board? Are you trying to update existing rows, or insert new ones?

The first thing I notice though is that you are overwriting the $pages variable to one specific page and also getting that page in every step of your loop.

Also, please don't reply here, but rather re-post this question in the Table support board with some more details as I mention above.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...