Tagged Questions

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

-1
votes
1answer
13 views

How can I recover from a backup but include many changes from a dynamic site?

After the Drupageddon disaster, I've discovered that my backup plan is not sufficient. I have daily, weekly, monthly and yearly DB and file backups thanks to backup_migrate and backup_migrate_prune, ...
0
votes
1answer
13 views

SQL command to remove hypens from data value

A commerce site that I am working on has products titles and skus in the format of DS-PC-CDJ2000. The client wants the each hyphen removing and replacing with a space; DS PC CDJ2000 There are ...
0
votes
0answers
13 views

ReCreated a Content Type but it does displayed

I seem to have run in to a problem when re-creating a Content Type, I had a Content Type called Gallery on my drupal 7.32 site, I then deleted it, but then wanted to create it again. When I re-created ...
0
votes
0answers
27 views

Why my query fails with 'Object of class stdClass could not be converted to string' error?

From a custom module I'm trying to retrieve some a value from the db like this: $registration_data = db_query('SELECT n.state FROM {registration} n WHERE n.user_uid = :uid AND n.entity_id = :eid', ...
0
votes
1answer
8 views

Retrieve a list of values from a lookup table using db_select

I have a "jobs" table where each job can have multiple specialties. So I have a specialties table with a list of all available specialties and I have a lookup table that just has a job_number and a ...
0
votes
1answer
15 views

How do you check if table is empty before resetting the auto increment

I have a database table that a user can add to and remove data from within my drupal module. What I would like to do is automatically check to see if the table is completely empty after every delete, ...
0
votes
1answer
18 views

Why won't my module table populate

I have a page that is supposed to output a table of values from my database. I am logged in as an admin and another page I created works just fine, outputting a form for data to be entered into the ...
0
votes
1answer
23 views

How do you render a table within a custom module in drupal?

I have a page on my Drupal module that is responsible for the input of goals to be completed by an admin. What I would like to happen is have all of the goals within the database table render below ...
0
votes
1answer
16 views

Creating item library, allowing user to make selections and publish to another page

Above is a rough MS paint concept I banged out to illustrate what I'm trying to do. I need to create a library of items, which have pictures, descriptions, names, etc. This library will be ...
2
votes
2answers
56 views

How to push form values to database in Drupal

I am building a drupal site in which I would like the admin to have the ability to input goals into a table on the drupal database that can then be output to other users to be completed. The form for ...
0
votes
3answers
36 views

Get all rows from database

I have the table where I store uid column, and I want to get all values from table, but I only get the frist elemnt, where is my problem ? My query: $sql = db_select('voting_nomination_counter', 'v') ...
1
vote
2answers
34 views

After migration the login form no longer submits, why?

I have been working on a Drupal 7 site on localhost (via WAMP) for some time now. Recently I wanted to migrate this website onto a new machine and continue working on it there. The steps I took: I ...
0
votes
1answer
12 views

What query string is used to display products in commerce kickstart?

I am creating a php script to display all the products from commerce kickstart database But the image is in a table called file_managed and the products are in commerce_products and i cant seem to ...
0
votes
0answers
13 views

How select id, name, image and price of product from commerce kick start database

I'm working on a php script to get all the products and images from the commerce kick start database but it seems not to work here is iv tried SELECT * FROM `field_revision_commerce_price` , ...
-1
votes
0answers
31 views

$node->sticky Always 0

Not sure what's going on and everything looks okay. In node.pages.inc while editing a node, $node->sticky always returns 0 regardless if the node has a value of 1. Going further back into the ...
2
votes
1answer
24 views

How can I substitute field in hook_query_alter?

I have a query, with a date field, let's say it is aliased as enabled. And joined table with field enabled_for_website. In my query alter, I want to substitute global enabled with date specific to ...
0
votes
1answer
16 views

Use an existing Drupal site to create a new site

Today I tried to copy a existing Drupal site for creating a new one on a other domain-name. The problem: the new website still uses the old DB. So if I create a new user for example, this user also ...
0
votes
2answers
37 views

Manage database and draw Graph

Iam new to Drupal. I need help , because as a beginner i want to create a website which need to store lots of information. And from the collected information ( statistics ), i want to map a Graph out ...
1
vote
1answer
117 views

Make a direct database query

Basically I want to run this query against the current database and retrieve all node titles with node type of foo_type. SELECT title FROM node WHERE type='foo_type' ORDER BY title ASC How can I do ...
0
votes
1answer
19 views

Removing file from form breaks site

I created a module that hooks into the admin menu and allows you to upload a specific file for the site to use. It allows you to upload a file, and change a file, but as soon as you remove a file and ...
0
votes
0answers
13 views

Webform Submission & Commerce Order Database Relations

Where is the relation between Webform Submission ID & Commerce Order ID in the drupal database? The problem is one of my orders crashes after editing the webform so I guess that the relation ...
-1
votes
2answers
29 views

Drupal database: how to join 2 tables?

Currently I'm learning drupal database command as I'm pretty new to Drupal, I'm more familiar with mysqli api. I want to check the role of user before they are logged in to the system, the role table ...
0
votes
0answers
19 views

Why is my database table not being created with hook_schema?

I have a custom module called inventory. I disable the module, then uninstall, and finally reinstall. But, the database table inventory_defaults never shows up. Do you have any idea why the ...
0
votes
1answer
25 views

Why does a try block affect drupal_set_message?

I have a try block set up: try { //some code throw new Exception ( 'My exception message' ); } catch ( Exception $e ) drupal_set_message('Caught exception: '. $e->getMessage(),1);} But ...
2
votes
1answer
43 views

Multi-site installation with shared database but different user table

I need to install drupal multi-site with shared database but just need to create some tables specific to that site like, users table should be different for sub-sites. I know about full sharing or ...
4
votes
3answers
145 views

Whats faster db_query, db_select, or EntityFieldQuery

So I'm trying to find out what is faster db_query, db_select, or EntityFieldQuery. Currently I'm using EntityFieldQuery. I'm grabbing about 1600 node entries. I realize this can be taxing on the ...
1
vote
1answer
19 views

Merge production site's content into staging through database tables

I am working on a major upgrade on my website which includes several new modules being installed, various theme changes, updates on existing modules and a few modules that were uninstalled. All the ...
-1
votes
1answer
31 views

Fatal error: Cannot use object of type stdClass Error help!

When trying to access my image file from my database i get this error: Fatal error: Cannot use object of type stdClass as array in ...
0
votes
1answer
27 views

Submit data into database

I have read a great deal and trying to learn how to get data into a table in the db. I have the below code to test entering just the first name of someone and I am getting an error. I have tried to ...
1
vote
1answer
60 views

Drupal 7 special chars not working in db_select

I have implemented custom search to get some values from node. When I'm using special chars like "/, ?, !", no result is being displayed. Example value : "24/7" or "site?" or "test!", etc... ...
0
votes
1answer
29 views

How to save a form inputs in database and retrieve it from database with out form submision

hi can i store form inputs in database and retrieve it from database with validation I search many sites but neither any documentation or example or any thing i found for drupal7 . I didn't ...
0
votes
1answer
61 views

Drupal issues - DB and modules in folder that doesn't exist

Ok, so I ran into an issue today that completely baffles me... I have a staging server that I have about 30 sites on. Most are WordPress and about 5 are Drupal. Yesterday I worked on a Drupal site ...
1
vote
1answer
201 views

User with uid=0 in database

I had to build a form with a select field populated with all the users registered in database. There are 10 users that I can see in admin>people. To get all the users, I used entity_load('user'). ...
3
votes
1answer
79 views

Can I rename a module?

I foolishly created a features module and named it events. This is bad because, of course, there is a registered module with that same name. So the update status report is always in error and drush ...
0
votes
1answer
47 views

Drupal entity from different database

I have an existing database (which is not under my control) that i want to use as base database for my entity. However I'm stuck at getting the data from the database. There already exists a question ...
0
votes
1answer
29 views

How to trim content from a heavy database [on hold]

I would like to trim content from a heavy production database (1GB), to reduce transfering time, local mysql import time and generally make it easier to work with. I know I can ignore cache, watchdog ...
2
votes
2answers
34 views

Possible to access source database in prepareRow() in Migrate module?

I'm doing a D2D migration that requires a mapping table to map tids from the source site to the destination site. In prepareRow(), I need to check the tid for a certain vocabulary and get the ...
2
votes
1answer
53 views

MySQL date format functions in Drupal

How can I do a MySQL date function in Drupal? I have this now: $select = db_select('someTable', 'st'); $select->addExpression('DATE_FORMAT(FROM_UNIXTIME(created), "%Y-%m")', 'createdMonth'); ...
7
votes
3answers
283 views

Site performance , cache not working properly

I am using the Performance Logging Module. Above screenshot, one strange thing I noticed that Insert Cache_bootstrap on every page. When you go to any page (both admin theme and frontend theme) ...
1
vote
1answer
18 views

How to extract query placeholders for debug purposes?

When I cast query to string, I can see WHERE that will be passed to the database, like this: WHERE (idProperty = :db_condition_placeholder_0) AND (idCategory = :db_condition_placeholder_1) But ...
1
vote
1answer
19 views

Creating a vanilla instance from a site already set up

I have a Drupal site which is set up, running and being continuously used. It has a variety of content_types, taxonomies and field_collections etc saved in the database. The plan is to sell on ...
0
votes
1answer
23 views

javasript invoking custom module to update user response

I have created Multiple choice questions in drupal . One node (page ) has one mcq . The answers are displayed by simple radio buttons and javascript . Now I am planing to give some dynamic behavior ...
0
votes
1answer
12 views

How to prepend a Views query with another query?

Due to a configuration problem at my host, I'd like to execute the query "SET optimizer_search_depth=0;" in the same DB session as a specific Views query. I looked into hook_views_query_alter() and ...
1
vote
2answers
40 views

Splitting up a Drupal database

Is it possible to split the Drupal database into multiple databases. For example I have one database having the watchdog table and another database having all the other tables? I know if I created my ...
0
votes
1answer
36 views

changing unicode characters in a module

There are hundreds of records in a database that are in windows-1256 charset, I want to read these data and convert them to utf8 then insert them in a new table, to read these data I need to change ...
0
votes
1answer
27 views

Shared database during development?

Sometimes I need to collaborate with a more frontend-centric developer to help implement a site. So typically they're only changing CSS and minor template changes. The way we've handled this in the ...
0
votes
1answer
18 views

Schema relationship

The problems I am trying to solve are: 1- How can I connect tables defined by $schema to each other? 2- How do you insert data consistently into the database? Is there any possibility of having ...
0
votes
2answers
26 views

How add/update a record conditionally based on existence of primary key?

I have a table with structure: Table ( record_1 int, record_2 int, PRIMARY KEY (record_1) ); I want to write/update a record based on its existence. I was told to use drupal_write_record(), but for ...
0
votes
1answer
26 views

Changing Drupal database

How would you think if a designer extends the database of Drupal for a desired system? (for example adding field to some tables) Would it be really PRACTICAL?
0
votes
1answer
16 views

Bulk change radio button setting in admin/content using database

I am using a paywall module called TinyPass where I have to check a radio button in order to activate the paywall for a specific node. I now have a situation where I want to uncheck (or deactivate) ...