Hello friends,

First of all I apologize for my level of English.

I request your help because I have a problem with a custom module that I created following a tutorial.

With the administrator everything goes me perfect but with a normal user it gives me error in the following instruction.

<?php
$query = \Drupal::database()->insert('linkdescarga');
	$query->fields([
	  'clave',
	  'FACT_NomApe',
	  'FACT_Cif',
	  'FACT_Direccion',
	  'FACT_Cp',
	  'FACT_Ciudad',
	  'FACT_Actividad',
	  'FACT_Ficheros'
	]);
	$query->values([
	  $clavefichero,
	  $FACT_NomApe,
	  $FACT_Cif,
	  $FACT_Direccion,
	  $FACT_Cp,
	  $FACT_Ciudad,
	  $FACT_Actividad,
	  $FACT_Ficheros
	]);
	$query->execute();
?>

The execute command fails with a normal user. The table in which I will insert the I have created myself directly in the database.

Do you know what I can do? I have been dealing with this problem for several days and I can not solve it.

Thank you very much for your help.

A greeting

Comments

kunalkursija’s picture

Can you share the error you are getting( you can check the error in Recepnt Log Messages)

It would be great if you share the whole file code(functions around this query).

Also, About the direct table creation in database. This is not correct, you must follow the drupal way if you are working with drupal (i.e- Create .install file in your module & write hook schema).