MySQL is an open-source, relational database management system. Use this tag for questions specific MySQL, not for saying "I am using MySQL."

learn more… | top users | synonyms

0
votes
0answers
11 views

Drupal7 thousand of queries running for one hit [on hold]

I've been debugging a drupal website that was reported for a very slow performance and found out that it's been running thousand of quires on every hit. For example the following query that is ...
0
votes
0answers
14 views

Condition not working

I'm trying to do a sql which is $sql ="Select r.* FROM event_mgmt_registration r WHERE event_nid = $node->nid AND reg_id = $reg_id"; in drupal (as below) $node = node_load($nid); ...
0
votes
0answers
9 views

Drupal Views Relationship in Code

I am trying to write a custom relationship between two tables for Views, and it doesn't seem to be working. The code for my relationship is this: $data['gov_data_bill']['sponsor'] = array( ...
0
votes
1answer
34 views

Converting MySQL to db_select with subquery count

I have an SQL query, with subquery, that returns as set of nodes ordered by referenced nodes... It works fine in a db_query, but I need it to be dynamic, and it feels like a better idea to use ...
-2
votes
0answers
29 views

Drupal 7 sum grouped fields [closed]

Help solve the problem. It is impossible to produce the amount of the grouped fields. I can only add up all the fields. Example --> ...
0
votes
1answer
22 views

Your web server does not appear to support any common PDO database extensions

I'm trying to install Drupal7 or Drupal8 and keep getting this error: Database support Disabled Your web server does not appear to support any common PDO database extensions. Check with your ...
0
votes
2answers
29 views

Can drupal be installed on a subdomain and used on the main domain?

I was thinking about installing Drupal on admin.myexample.com for clients to access an add and edit news posts & products. Then just using myexample.com as the main site. Calling the database and ...
0
votes
1answer
35 views

Collecting user and node locations seperate or combined?

In my drupal site i like to have the location of users stored as well as the location of nodes. To store these locations i am using Geofield in combination with adressfield. Adressfield collects the ...
0
votes
1answer
28 views

How to exclude the user table using the drush sql-sync command

Could anyone tell me how to exclude drupal's user table from drush's sql-sync command? Thank you.
0
votes
1answer
49 views

Drupal Commerce Kickstart 2 Mysql problem: “Table XYZ is marked as crashed and should be repaired” [closed]

My drupal kickstart 2 site occasionally cause Mysql errors. This is what Drupal Logs say: "PDOException: SQLSTATE[HY000]: General error: 145 Table './MYSITE/field_revision_body' is marked as crashed ...
0
votes
0answers
20 views

Drupal Quickstart / Drupalpro - mysql misconfigured to “drupalpro” user

I've been trying to do a drupal quickstart-create database and its creating the database, but it only shows up on the root account, but its not creating it on the current user's account "drupalpro" ...
0
votes
3answers
45 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
votes
0answers
17 views

On click of checkbox send email to selected recipients [duplicate]

<?php if( isset($_POST['Submitter']) && !empty($_POST['Submitter']) ) { $to = "syz@gmail.com"; $subject = "Test Subject"; $body = "Test Body"; $headers = "From: ...
0
votes
0answers
43 views

Database issue with Drush aliases on Windows

I'm having issues getting the drush sql-sync command working, and it seems to be related to how my site aliases are set up. When I try to run the sql-sync command with my local and production aliases, ...
0
votes
2answers
88 views

Drush can't connect to local MySQL through socket on WAMP

Trying to set up Drush with in a local dev environment on Windows 7 and can't get MySQL properly configured. A test command I've been running via Cygwin, with the resulting error, is as follows: $ ...
0
votes
1answer
31 views

Loading a large node body sequentially for better performance

I have a few very large nodes on my Drupal 7 site. In some cases the body field contains about 2MB of raw HTML (about 250,000 words). Despite the site performing well as a whole, the sheer size of ...
0
votes
2answers
31 views

Using db_select to only get the latest nodes with a certain field value

I have extending a query function for a D2D migration. The nodes have a field on them for a certain type of ID. In the old D6 site the the field did not have to be unique, but in the new D7 site the ...
0
votes
1answer
49 views

How to add two fieldConditons in Entity field Query?

Is this the correct way to add field Conditions $query->entityCondition('entity_type', 'profile2') ->entityCondition('bundle', 'user_profile') ->fieldCondition('field_town_city', ...
0
votes
1answer
53 views

multiple entity type in entity field query

how to add mutilple entity_type and bundles in EntityFieldQuery? $query->entityCondition('entity_type', 'profile2') ->entityCondition('bundle', 'user_profile'); Is there any way to do ...
0
votes
0answers
60 views

Webforms module breaks MySQL database

I've got 'Webform 7.x.3.20" installed on my Drupal 7 and it works perfectly, apart from it seems to have 'broken' the MySQL database. I first noticed this when I tried to use the 'Backup and Migrate' ...
2
votes
1answer
92 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'); ...
1
vote
1answer
39 views

Troubleshooting a slow query

I've taken over a Drupal 7 website, and i'm having trouble with a slow query that is run when an editor visits the /admin/content page. The query in question is the following: SELECT COUNT(*) AS ...
1
vote
2answers
33 views

select nodes whose created date in hours is equal or larger than 48 hours

I make a PHP routine in which all node is selected and check created date and delete those nodes which is created in last 48 hours or greater. $result = db_query('SELECT n.nid, n.title, ...
0
votes
1answer
85 views

Drush: how to set access to MySQL

When I run command "drush status" I cannot see any MySQL settings (user, password or database). I cannot use commands like "core-quick-drupal" because it requires access to MySQL, before ...
0
votes
1answer
39 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 ...
1
vote
1answer
52 views

Possible to use PDO inside a custom module in Drupal 6?

I'm about to build some new functionality on an old Drupal 6 site which will be upgraded to D7 or D8 within a year or so. This new module is heavy on the SQL and I'm building many complex SQL queries. ...
0
votes
0answers
21 views

Specify binary order in sql query

In custom module which selects field (collation: utf8_latvian_ci) from database ordered ouput gives wrong alphabetical order: "Aaaa, Āaaa, Abb, Acc" instead of "Aaaa, Abb, Acc, Āaaa". This can be ...
1
vote
1answer
33 views

Write form value to database

I need to save this to database, but could not find a way to make it work. Now this paypal_email is only saved to current user. Apparently it is saved somehow to the database under user table, but it ...
0
votes
1answer
27 views

Drupal - Microsoft SQL Custom database

I would like to get some opinions on the following challenge: A client of mine has a desktop application that has been built in .net and is backed by a Microsoft SQL server to store all the records. ...
1
vote
0answers
37 views

mysql_fetch_object returns object while false is expected [closed]

Im having a weird case where an object is being retrieved while Im expecting false, here is my query mysql> SELECT full_name, uid, name, picture FROM Table1 INNER JOIN Table2 using (uid) LEFT JOIN ...
0
votes
1answer
35 views

Move DB from Apache to IIS

I've been working on a Drupal site under a LAMP configuration. My client uses SQL Server, so after I'm done with development I need to move the site over to their configuration. I work on Linux, so I ...
3
votes
2answers
189 views

Where to query database in a module

I'm creating a module that is basically a form but needs to use information from a table in the database to react the some of the button presses. Rather than executing the database query each time the ...
0
votes
0answers
24 views

Notice: Undefined index: distribution_name in drupal_install_profile_distribution_name()

After upgrading from d6 to d7 it shows the notice as follows Undefined index: distribution_name in drupal_install_profile_distribution_name(). I want to solve this issue without changing any ...
0
votes
0answers
35 views

mysql error 1045 unable to access mysql database

I've been working with the DAMP stack for a while until I've been getting this error whenever I stop the server and re-initiate it. This is the following message. PDOException: SQLSTATE[28000] ...
0
votes
1answer
32 views

mysql.sock file deleted mistakenly from mysql/tmp [closed]

I was stuck with a PDO Exception PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in lock_may_be_available() (line 167 of ...
0
votes
2answers
53 views

Complex condition drupal query

I'm trying to add following mysql condition: WHERE DAYOFYEAR(curdate()) <= DAYOFYEAR(DATE_ADD(FROM_UNIXTIME(field_birthday_value, '%y-%m-%d'), INTERVAL (YEAR(NOW()) - ...
0
votes
0answers
21 views

How I can disable block view from database D7 [duplicate]

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away I have Last error, this error will be resolved when a user increase max allowad packet Im do it and set it 500MB, and Im ...
0
votes
1answer
67 views

Pulling user data from external database

I have a game that utilizes mongodb to store the user information. What I am trying to do is use drupal as a community front so users can register for the game in drupal. The problem is that I don't ...
0
votes
2answers
44 views

delete users and all its related records

Is there a way I could run mysql query from the backend to delete all the users and its related records except master-login. There are some modules that help to do it or a via drush command but I am ...
1
vote
1answer
202 views

How can I remove emoji from all user input?

It looks like iPhone emoji are not currently supported in Drupal 7 on MySQL. When I try to save a node containing an emoji (I 💛 U!) in the database, I get an SQL error: PDOException: ...
0
votes
2answers
76 views

How to create sql alias in drupal 7

How do you achieve the highlighted 'node' alias when using the Drupal 7 database abstraction language? This is the original query produced by the view SELECT node.title AS node_title, node.nid AS ...
0
votes
0answers
49 views

Tracking the userID

Where can I find the code where Drupal sends strings (such as the userID) from a content submission page to the node table in the database? If you know of a guide that explains the Drupal content ...
0
votes
1answer
31 views

Help me with my page, when open this page shows me this:

PDOException: SQLSTATE[HY000]: General error: 145 Table './mapibrasil/watchdog' is marked as crashed and should be repaired: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, ...
0
votes
0answers
22 views

Drush won't bootstrap database in Windows

I'm using Windows IIS running under the Parallels Plesk control panel and installed Drupal 7.2.x and I also install Drush. I'm able to run basic commands but I'm unable to run any commands like SI or ...
0
votes
1answer
120 views

Corrupted mysql cache_rules table - dropped the table and now I cannot create it anymore!? Stuck

I'm not sure how this happens, but the cache_rules table is corrupted and it prevents me from doing a drush cache clear all. I dropped the table successfully, but now I can't create it. Throws this ...
0
votes
0answers
62 views

Drupal PrivateMSG Module: How to print Inbox msg Count & Outbox msg Count?

Can someone please tell me how to do this please? I know how to display the unread count, but i also need to print the inbox and outbox count in my custom module. Some help would be much appreciated, ...
1
vote
1answer
109 views

EntityFieldQuery with “NOT IN” FieldCondition and “=” FieldCondition on the same multi-value field is only processing one FieldCondition

The EFQ is: $query->entityCondition('entity_type', 'node') ->fieldCondition('field_terms_wb_access', 'tid', array_keys($children), 'NOT IN') ->fieldCondition('field_terms_wb_access', ...
1
vote
1answer
84 views

Why drush sql-sync fails with mysqldump unknown variable error?

I am having issues trying to sync my staging server with my local server using drush sql-sync command. I've set my aliases right and the same configuration is working with my development server and ...
1
vote
1answer
50 views

Find users who have not uploaded certain contents in last 30 days [closed]

I need to find users who have not uploaded certain contents in last 30 days. I have tried this query it is not working. Can anyone help me? select uid, max(created) as max_created from node where ...
0
votes
0answers
15 views

How do I handle large tables when performing a migration with the Migrate module

I am using the migration module to import a list of machine parts from a simple mysql table. The table has six columns and around 320,000 rows. My first attempt used a query that pulled in the ...