Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [database]

Drupal provides a standard, vendor-agnostic abstraction layer for accessing database servers.

1
vote
0answers
21 views

entityQuery where a translation with a different value returns incorrect nodes

The title seems a bit odd, I know, but I couldn't find any issues similar to this and that's the best I could come up with. We are running into an odd instance of entityQuery returning nodes that ...
0
votes
1answer
11 views

How to display my array values in nested array of type stdClass Object

i am having trouble figuring out how to render my array fields values for specific fields. So far i've managed to query my db and collect the node values and save it to my cart of items. However, i am ...
0
votes
1answer
12 views

Finding entity/webform fields in the database

A bunch of user accounts were deleted and recreated with new UIDs, and so any webform submissions or entities that have fields pointing to the old UID are now broken/wrong. I already updated some UID ...
0
votes
1answer
18 views

Drupal db select IN, group by count

need a bit of help please, when i write my query like this it works fine $query = db_query('select * from form_submissions where address in (select address from form_submissions group by address ...
0
votes
0answers
34 views

dynamic query with NOT IN doesn't work properly

I used the 'NOT IN' clause in serveral occasions in my drupal 7 code, without checking the results. But now a particular situation caught my attention. I have to exe a query to a separate db selecting ...
-4
votes
0answers
16 views

deleted matrix field [on hold]

The matrix field got deleted while i was editing the field just above the matrix field.i HAVE CREATED ANOTHER MATRIX FIELD OF THE SAME NAME AS MINE IS A WORKING SITE. cAN U HELP ME TO GET BACK THE ...
0
votes
0answers
21 views

Creating new node entity during presave of another node entity causes SQL Exception sometimes [on hold]

We have a Donation Record Content type and a Donor content type for a Blood Bank management drupal application. A donor can have any number of donation record. The system does not explicitly require ...
0
votes
0answers
16 views

If field name is end with underscore example field_data_my_field____ in Drupal 8 than what issue or failure can come

Suppose if I have created some field in content type example: node field . machine name (field_node_filed__) So what is the draw back of fields machine name is ending with (_) underscore. Is it ...
0
votes
0answers
18 views

Updating the delta value on a custom field

I have a content type with an image field and I am trying to update the delta value. I'm assuming the delta value is used to sort the images when they're rendered. (If there is a better way please ...
0
votes
1answer
52 views

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: [duplicate]

After entering some custom fields, I went to /content and now I am getting the following error: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. I've tried the following with no ...
0
votes
0answers
18 views

Menus, drush uli link, and some images not working after moving site to localhost

I've just gotten a site I'm supposed to do some work on but I'm having trouble with migrating to a local development environment. I don't have admin access to the site itself, but I do have access to ...
0
votes
0answers
12 views

The menu_route table is deleted when activating the conntributed module

You have a Drupal 7.4 installation that was built with Oracle 12C Enterprise Edition, Linux RedHat Server 6.0, PHP 5.3, was updated to Drupal 7.59. The current problem is when installing a module ...
0
votes
0answers
36 views

Cannot db_select join extra taxonomy term

I have 4 taxonomy term fields with a total of 400 terms, and I have to query the input field from node/add reference field against the database. $query = db_select('entityform','e') ->fields('e'...
0
votes
1answer
25 views

Conditional clauses with Entity field Query

I have a syntax issue on using conditional clauses with EFQ, but the documentation on drupal.org is a bit unclear for me. I have google the whole Internet for this with no results at all. My hook ...
1
vote
0answers
11 views

Select locale translation info from non-default database

I setup 2 databases connections in settings.php, one is MySQL on which Drupal is installed and running, the other is Oracle from which sometimes reading some info non-relevant to Drupal as below: ...
0
votes
1answer
21 views

How do i select all from database and do while loop with them

I did this easy select and im getting Error: Call to a member function fetchAssoc() on boolean , im beginner, im just trying to pull out two variables and make operations with them. $result = ...
1
vote
0answers
31 views

Optimize custom database queries

I am building my first Drupal 8 module and wondering how to optimize work with multiple queries to the database? $query = \Drupal::database(); $transaction = $query->startTransaction(); $product = ...
0
votes
0answers
14 views

How to get / pull unique values from Database and not duplicates?

I have a multi-site and a database full of values that are identical, with the only thing separating them apart is the type of site. For example: Site1 = Myvalue1 Site2 = Myvalue1 Site1 = Myvalue2 ...
2
votes
0answers
107 views

Per Bundle Storage for Drupal 8?

In Drupal 7 there was the start of Per-Bundle Storage (PBS) to try to store field data in a single database table if that made sense and was possible given the nature of the field. The PBS for Drupal ...
-1
votes
1answer
15 views

How can I add an array or a new value to the query condition? [closed]

I need to add a new type of content in my query condition, but I don't know how to do it. This is the code I am using. $query_result = $query->getQuery() ->condition('type','series'+ .........
-1
votes
1answer
31 views

Invalid parameter number: number of bound variables does not match number of tokens: SELECT 1 AS expression

Good Morning I get this error: Invalid parameter number: number of bound variables does not match number of tokens: SELECT 1 AS expression (edited) I need to insert an array of values into a field ...
1
vote
1answer
42 views

basics of settings.php and settings.local.php?

What is the up-to-date basic workflow regarding database credentials when you launch a local version of a site that is already operating remotely? What are the considerations and how is each best ...
1
vote
0answers
25 views

Caching and Mysql binary logs [closed]

In my recent Drupal 8 project, we have the master-slave setup and we face binary-log files getting generated to a huge amount for every hour. On decoding these binary log files we figured out a lot of ...
0
votes
1answer
27 views

How to group by one field

I have a view which shows the users subscribed to the website. Some users have multiple roles, therefore, on the results, there are some duplicates. What I want to do is to remove these duplicates, ...
0
votes
1answer
35 views

Render entity fields retrieved by EntityQuery

I'm building a table with TableSort retrieved by EntityQuery like explained in this post. The result fields vary a lot and I have a hard time to figure out how to render the results of the different ...
0
votes
1answer
46 views

EntityQuery on nodes related by ERR and paragraphs

I have content type Publication which relates to content type Project using paragraphs: Publication [field_mention] -> Mention (paragraphs) [field_project] -> Project Now I want to show all ...
0
votes
1answer
27 views

How to add a column to DB with weight by using hook_update_N?

I want to add a column to a database by using hook_update_N(), but it should be 3rd column instead of last column. How I can achieve that please help in this regard. I tried to add weight but not ...
0
votes
1answer
37 views

How do I order a search query by best match?

I am using the following code. $query = \Drupal::entityQuery('node'); $query->condition('status', 1); $query->condition('type', 'article'); for ($i = 0; $i < count($split_keys); $i++){ ...
-2
votes
2answers
55 views

How to write a static query? [closed]

How to write static query in Drupal 8? SELECT count(*)' FROM {users}); Can we write in the same way that we did in drupal 7? I need to know proper way of writing static query?
0
votes
1answer
37 views

Can't clean URL from custom query parameters

I have a client whose company has different branches. The data are retrieved from a DB (not the Drupal one). For example, the url mydrupalsite.com/branch?branchID=1 should lead to mydrupalsite.com/...
1
vote
1answer
30 views

How can I have separate databases for each domain (countries) of my Drupal website?

I want to have one Drupal website codebase and one apache server instance, but have each country (domain) have it's own database. Practical example: I want all content to be completely separated ...
2
votes
1answer
30 views

“Experimental modules found: Place blocks” but I am using core 8.6

I am using Drupal 8.6.2. When I open the status report I see the following warning: Experimental modules found: Place Blocks. Experimental modules are provided for testing purposes only. Use at ...
1
vote
1answer
71 views

How to update the database schema without losing existing data

I have a custom module with my_module.install file defining my two data tables in mysql. Module is already installed and I am able to save data from forms into them. Now my requirements changed and I ...
0
votes
0answers
8 views

Unexpected behavior when searching the result of a database query

I have a simplesamlphp_auth hook to alter the users allowed to login via the federated login. Inside of this hook, namely hook_simplesamlphp_auth_allow_login(), I make a static database query like so, ...
0
votes
0answers
74 views

How can I tell Drupal to skip a failed DB update instruction?

when updating from 8.5.x to 8.6.1, an error happened when running one of the database update instructions. More precisely, the error occurs when Drupal is trying to run function taxonomy_update_8502()....
0
votes
1answer
19 views

Is db_set_active a global or local setting?

I need to run a new query on another database. I configured the settings.php $databases = array ( 'default' => array ( 'default' => array ( 'database' =...
0
votes
1answer
50 views

Querying a custom table does not return latest results for anonymous user

I have a custom module and a simple custom table in the database. When I try to query the table to get the row, it seems Drupal 8, or maybe mysql, is caching the results. $connection = \Drupal::...
0
votes
1answer
28 views

How to specify AND, OR with dynamic query

I’m trying to create a dynamic query, the query logic conditions needed are: AND, and OR. The main query will include two sub queries. The ConditionInterface::condition documentation states that: ...
0
votes
0answers
13 views

Drupal Views3 Integration

How do I grant SELECT access for the Drupal user to all the CiviCRM tables using AWS RDS Database?
0
votes
0answers
14 views

Change date field; how to add timezone handling later

About date fields, this page https://www.drupal.org/node/767182 says If you start off without a time zone, but then realize that you need one at a later date [...] Perform the switch in the ...
0
votes
2answers
65 views

How to use between date query?

I have 2 fields in a node and I'm trying to get the expired nodes set in "Start Date" and "End Date" field. I'm using db_select to get the start and end date values. How can I add a condition to ...
0
votes
1answer
22 views

Dont save webform data to database

For SPECIFIC webforms, how can I make it not save data to the database, but just send the email? It should however still save the files and link to them in the email. Idk if I can use something like ...
1
vote
1answer
35 views

For external data, should I create custom table or new entity type?

I have a database that exists outside of Drupal. I wish to show the summarized data from that database on Drupal. At a high level, you can see the structure of the data below. | Seller's ID | ...
0
votes
1answer
88 views

How do I add edit/delete buttons to a custom module items list? [closed]

I have a custom form on my development site for visitors to create requests, with 3 fields: name, contact, and request. This is the code in RequestForm.php. public function getFormId() { return '...
1
vote
2answers
51 views

Can I change the Display Settings by modifying the database?

I am using Drupal 8.5.6 and need to make the authoring information hidden for each content type. In other words, there should be no 'authored by admin on (date)' on any page. The fix should be simple (...
1
vote
1answer
42 views

How can I assign a database for each user?

I am new to Drupal and facing problems. I want to assign a database for each user where user can edit, delete or make entry to their database table. For example I want to develop a database ...
1
vote
1answer
20 views

Get all nodes where date field matches month and year

I have a content type with a date field (myFieldDate) whose values are timestamps. (I'm collecting only day, month, and year.) I have a custom form where I have a select list to select month and year....
0
votes
1answer
30 views

How can I add multiple conditions for the same field taxonomy term in views query?

I make some query for views filter for nodes. Use in hook_views_query_alter. $definition = [ 'table' => 'node__field_characs', 'field' => 'field_characs_target_id', 'left_table' => '...
0
votes
0answers
30 views

How do I access the database? [duplicate]

I want to access the database from my file, XAMPP/htdocs/PROJECT-NAME/getdata.php. I am using the following code. define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/core/includes/...
0
votes
2answers
41 views

db_select get value of the field

I have order form with field reference number. when a new order is submitted i need to get the last reference number. I did something similar long time ago in Drupal 7 but now i need to do it in ...