If the question is about SQL queries, consider using "sql-queries"; if the question is about the database API, use "db-api."

learn more… | top users | synonyms

0
votes
0answers
7 views

External data integrated in Drupal 7 - Create nodes

I have a lot of data which comes from a external data source. It is a ton of products, and the client wants a nice searching tool. As there are some other type of pages in the website, I decided to do ...
0
votes
1answer
20 views

Import date to Drupal

I am receiving data from a third party company through XML. I want to add this to my website as drupal nodes, having some information like title, body, summary, image,... I am able to make a cron job ...
0
votes
0answers
15 views

How to set query result on a text field?

I want to show a result of a select query (with row count) in a text field after submiting. Here is my code : $form['my_textfield'] = array( '#type' => 'textfield', '#title' => ...
0
votes
1answer
17 views

Status report says database out of date, but update.php and drush say up-to-date

Drupal 7.39, all modules updated to their latest version using Drush 6.6.0. When I look at the status report it says 'database out of date'. When I do drush updb or call update.php both report that ...
1
vote
1answer
18 views

How to send a simple mail to a user?

I'm implementing a function that send the password to a user (if he forgot it). It's a really basic function, all I have is user email here is my function : function my_module_lost_password ...
1
vote
2answers
23 views

Database system table problem

I read this article. Where is the location of "system" table. Is the image "system" table? phpMyAdmin To disable a module via phpMyAdmin you must login to phpMyAdmin. Then you must locate the ...
0
votes
0answers
26 views

How to use param on an update request in services module?

services provide update service (using PUT request) with parameters on path like : http://localhost/drupal/update_pass/my_resource/83 (83 is a uid) it's because in resource code it looks like : ...
0
votes
0answers
18 views

How to update users password using a custom ressource?

i'm using services module, i want to modify (update) password on users table Here is my ressource : 'client_modification_mdp' => array( 'operations' => array( 'update' => array( ...
0
votes
0answers
20 views

how to make a range to a result query composed of array of arrays?

my db_query_range returns many arrays (sections) and every section contains an array of books (in french : livres). When i limit my result to 10 elements i mean that i want to have 1O books in every ...
0
votes
1answer
17 views

How to import an SQL file and COMPLETELY erase the previous one

I'm having a hard time with buggy modules and need to do a lot of installs, uninstalls and so on. But even if I uninstall, the modules leave data on the SQL file, and the only way to start from ...
0
votes
1answer
51 views

How to insert multiple checkbox value in database?

In the process of creating data base, I need to read the Name, Father Name, Gender and Language. I could able to successfully store the data for all the fields stated above. When it comes to language ...
0
votes
0answers
20 views

How to insert option text in database instead of index key for a form input element

I'm inserting checkbox value, radio value and dropdown value in database. At the time of inserting the data in database the index value of them are stored but I want to store text value of them. For ...
0
votes
1answer
13 views

How to apply node access rules when querying menu_links table

I am creating a custom block which displays a menu. The menu is constructed by retrieving certain menu links from the menu_links table in the database. It has occurred to me that building it this way ...
2
votes
1answer
315 views

Can I truncate users table?

For some reason, I need to truncate the users table, but I don't want to remove the user with ID equal to 1. Is there any way to do it?
0
votes
1answer
18 views

How to insert a hashed password into table users?

I'm using services module, but i've created my own resource 'login', I'm using $data to store username + password. When i use postman, I put a text plain for password, and in my service code i've ...
1
vote
0answers
20 views

Drupal images/links at the wrong URL(sometimes)

I have a Drupal website installed on cPanel. the site is at http://example.com Everything is working good, however at times, sometimes the images/links will be changed to a different URL then the ...
0
votes
1answer
17 views

drupal site crash and went to maintenance mode

While creating a huge volume of pages in drupal website, our live site went down after 5 hours. We investigated logs on Apache, PHP and MySQL thoroughly but couldn't identify any specific cause or ...
0
votes
1answer
15 views

How to set an alias to a fields on a db_select?

Like it said on the title, as we use alias to fields with a static query, i want to do same thing with a dynamic query example : with static select : $sql = db_query ("SELECT my_super_long_field as ...
0
votes
1answer
24 views

Creating custom button that gets a certain views block on the database

Is there a way to create a custom button that gets a certain views block on the database upon click? I want to write a custom function button that upon click, connects to the database, retrieve a ...
0
votes
1answer
34 views

How can I use different database backend for certain tables?

What do I need to do in order to serve config entities from Mongo and cache from Redis database backends? So basically: a) how do I tell Drupal that I want to use different db backend for certain ...
0
votes
0answers
17 views

Can I make a custom resource on services with 2 args (int) to retrieve with?

My custom resource consists of retrieving with two arguments that are : entity_id and uid from a custom table i've created. It doesn't work for now Can I do that : ...
0
votes
1answer
29 views

How can I write users table data in custom file?

I have a number of users in my site,I have developed custom module for drupal mail functionality. But I want to write test cases for custom module. then here is the problem is how can I get the ...
0
votes
1answer
55 views

how to insert an array in another one?

This is an index (of module services) I created a resource that index books on a home page of a mobile app( this is not the most important in my question) I want to get books that have same tid (from ...
0
votes
1answer
17 views

How to put db_merge into a try catch?

in my code i need to use db_merge , that works well, but I'm looking for a way to show message when db_merge do not insert a record (to avoid duplication) the message would be : "you can't add this ...
-1
votes
1answer
19 views

Database password changed and I am not able to access my site

I am using xampp for the hosting for my drupal site I started with no password for the database root, and I used this database in the installation process of my drupal site where user name is root ...
1
vote
1answer
18 views

How to put multiple fields in an index operation on a GET HTTP request with services?

I'm working with the module "services" everything's ok with a get request, note that i've create my own custom resource with CRUD operations, the "retrieve","update" are ok but the problem is with the ...
1
vote
1answer
23 views

How to create a Webform pre-build option list via a query to an external database?

I'm trying in Webform (version 4.9) to create a pre-build option list with data from an external database. A pre-build option list is an available list you get when creating a "select options" field ...
1
vote
0answers
37 views

How can I setup multiple database connections in Drupal 8?

Can anyone help me to setup connection with multiple databases connection in Drupal 8? I have database on the same server and I want to access it along with default Drupal 8 database.
0
votes
1answer
19 views

avoid duplicated records with drupal_write_record

I want to test drupal_write_record, the insert part is ok, but this function seem to duplicate records. How to make a condition for if new record is already stored ? some like db_merge with key ...
0
votes
0answers
11 views

Drupal Data Base table missing [duplicate]

can anyone let me now if i could create tables manually on my Data basem and if yes how can I do it, just that one of the tables is missing, thanks
0
votes
0answers
31 views

The website encountered an unexpected error. try again later

Hi guys I get this message when trying to get acces to my web loging as admin this is the error The website encountered an unexpected error. Please try again later. is only when trying to get access ...
1
vote
0answers
22 views

My node.title differs from the title field in the database

I have a wierd problem i can't seem to get a solution to. I have a Drupal 7 website with more then 10000 nodes. And i recently discovered that 2000 of them have exactly the same typo in the title. So ...
1
vote
1answer
22 views

Difference between drupal_write_record and db_insert

I want to know what is the difference between drupal_write_record and db_insert example : can i translate that drupal_write_record('MyCustomTable', $Myrecord, $primary_key); to an insert query ? ...
0
votes
1answer
20 views

Drupal table name prefix

Is there a required format for table name prefix? I know that in MySQL installations it must end in an underscore like prefix_ but I want to know if that is also the required format for Postgres and ...
0
votes
1answer
17 views

How to map uid in users table data to the entityid in feild table to retrieve data of the users in drupal7

I would like to retrieve data related to users with the uid in users table. But the uid is not mapped in the feild_data tables which has entity_id and entity_type. How are these two ids mapped in ...
0
votes
2answers
25 views

Update database after feeds' import

Hello Drupal community, I'm trying to develop a customized module that updates the database with some operations on some fields (geocoding an adress field) after an import using feeds. Any idea which ...
0
votes
1answer
12 views

How to get each db result value count

How to get values count in db_select My query is: $last_item = '2015-07-19'; $query = db_select('field_data_appointment_date','ap'); $query->join('field_data_appointment_slot','aps','aps.entity_id ...
3
votes
5answers
94 views

How to restore complete database keeping the site in maintenance mode in Drupal 7

I need to restore complete database in a regular basis (weekly). I am using pure PHP + system call to mysqldump and mysql to backup and restore full database. The restore process takes 2 minutes. What ...
0
votes
2answers
65 views

db_query and db_select

I have static query (db_query works great) but for some reason, I have to put a condition to the query result I don't want to re-write the same db_query with "where", I'm looking for a way to write ...
0
votes
1answer
40 views

db_select sub query

I need to use sub query on db_select but, as you can see the sql, I think the first select should be like db_select('tabe1','tab') but this table is a "virtual" table I've to create temporary only for ...
1
vote
1answer
30 views

How do I add a COALESCE to a db_select?

I want to achieve the following query using db_select(): SELECT Column1, Column2, COALESCE(Column1, Column2) AS Column3 FROM TEST_ATTRIBUTES How do I add the coalesced column to the ...
0
votes
1answer
33 views

Store query result on an array

this is a simple query $sql = db_select('node','n'); $sql->fields('n', array('uid','title')); $s = $sql->execute(); I need to check the uid of all records : if('n.uid' !=1 ) { do some ...
0
votes
2answers
20 views

Where can I change this value?

I'm trying to change the phone number displayed in sidebar window with the chinese lady in it. However I'm trying to find out where it's content is coming from. This is how the HTML looks <div ...
0
votes
0answers
15 views

Links to show Portfolio of sites

I would like to make a Drupal site where I can make a list of sites using views, where when you click on one of the site links it would show the concept site that I have made. I will be utilizing ...
2
votes
1answer
33 views

Error when trying to extend a db_select query

I'm trying to add a field to my query by using addField(). However, whenever I add this to the query I get a whitescreen and an apache error message on the line after. Any help in resolving this would ...
0
votes
1answer
11 views

Is necessary any sanitization functions if I use the database layer correctly

In Writing secure code said: Use the database abstraction layer to avoid SQL injection attacks Then, my question: When I get value for a user form is necessary pass to check_plain() or others ...
1
vote
2answers
56 views

How to make higher the value of the field nid in the node table in database?

I'm using feed to import node from other system. This system uses very long number for its node id, like: 17675272378. As you can count this number has 11 digits. The problem is that Drupal allows nid ...
3
votes
2answers
49 views

How do I store large volumes or data points using Drupal ( temperature and humidity points )

I'm trying to use Drupal as a headless API, and so far I'm having good results. One of the things I'm collecting is a Temperature and Humidity data. Thus far I've created an entity that can hold the ...
0
votes
1answer
18 views

Automated database history save and recovery Drupal 7

I have a site implemented in Drupal 7. I want to make a history database recovery tool, which will recover previously recorded MySQL data. I have tested correctly on non-Drupal content which is used ...
1
vote
0answers
33 views

Drupal store into own database

Using Drupal 7 and trying to store registration information into my own database. I have a hook_form_submit() function that should be submitting the information into my own database table. what it ...