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
2answers
8 views

Adding Placeholders for PHP variables

When creating a query using db_query in my module I want to make sure it's as secure as possible. So I'd like to use placeholders in my 'WHERE' clauses. The problem I'm having is how to use ...
0
votes
1answer
24 views

Run a Drupal website offline (±without server)? — E.g. hand it over on a usb-stick / by mail? — Run it from the HD, while retaining functionality?

Why run Drupal offline? Since I use free webhosting, I don't have 100% up-time, so I started wondering whether I could maintain such Drupal functionality, while at the same time working offline. An ...
1
vote
3answers
28 views

Git-like way of updating Drupal database

It's easy to update Drupal on the local / remote server using Git. However, sometimes when I make modifications in the actual module settings or any other settings on my local server – those are ...
2
votes
4answers
109 views

How can I find a module or activity that is excessively writing to the database?

Problem: We have two productions servers: primary and failover. The two machines are linked via mysql replication. The mysql relay logs are clogging and bringing servers down the failover server. I ...
0
votes
0answers
19 views

How can I stop this query from being run by commerce module whenever I enable or disable new module?

I have a drupal commerce site that I created NOT with kickstart that has about 500K downloadable products (pdfs) and product displays. Whenever I disable or enable a new module, the multiple copies ...
0
votes
1answer
15 views

Problems with SQL Syntax using Left Join and OR

I need some help with my SQL. I've got the following code but it's returning multiples of each item and I don't understand why. When I only include the first Left join it returns results as ...
0
votes
2answers
35 views

My php is showing a numeric value for my list field…Why?

In a form I'm trying to take a value a user selected from a radio button and compare it with what's in the database. The value for the radio button is stored in $form_state['storage']['level']. The ...
-4
votes
0answers
15 views

How to make Table Joins in PHPmyAdmin of drupal database [closed]

I have 2 Tables in phpmyadmin that need joining uesr is my one and comment is the other, and are saved as drupaldb They both have a column UID and would like it to be joined on this column. In user ...
0
votes
0answers
19 views

Moving New Content from Local to Remote Prod Site

I have a local development Drupal site using WAMP to build. I moved it over to Bluehost successfully. But now I would like a process to regularly update my remote site with local changes I'm making. I ...
0
votes
1answer
50 views

Displaying Database Data Within the Flow the Site

I have a multi-page form that works fine in and of itself (pathfindertool.module). However, once a user clicks submit I want the page to display some records on the page. And it DOES display the ...
0
votes
0answers
5 views

Is geographical Mysql replication doable in Drupal

I have a website with 3 languages : fr/en/ja. I would like to have 2 database server (or 3 ?) : - DB Server A : manages traffic for fr/en - DB Server B : located in Japan - manages traffic from ja. ...
0
votes
0answers
12 views

How to fix encoding mismatch problem

So I had a local testing Drupal installation, which uses a MYSQL database version which supports utf8mb4 encoding. I deployed this local site to the remote server by copying the files and database, ...
1
vote
1answer
15 views

drush sql-dump gives warning

When I ran drush sql-dump --result-file, it came back with a warning and a success message. system(): Cannot execute a blank command exec.inc:36 [warning] Database dump saved to ...
0
votes
1answer
12 views

SQL replace() function in PDO

I'd like to convert the instructions from this answer into a general script that can be reused across projects. I'm wondering how these commands can be written in Drupal 7 PDO format: UPDATE ...
0
votes
1answer
18 views

What MySQL privileges would a read-only drupal db user need [closed]

I am in the process of configuring a server that will be on the front end and will be the read-only installation. Can anyone give me some guidance on what to look for for in regards to what tables ...
0
votes
0answers
10 views

How to move Drupal7 website on Bitnami stack?

I want to transfer my Drupal7 website from one local machine to the other. I have prepared database dump using BackUp&Migrate module. However, I can`t open website front page after putting the ...
0
votes
1answer
63 views

MySQL 5.1 to MySQL 5.6 Update Causes php-cgi Error in Drupal 7 - PDO Issue?

I recently performed a MySQL upgrade on Windows Server 2008R2. I moved from MySQL 5.1 to MySQL 5.6.22 (Community Edition). (NOTE: PHP is currently 5.3.0) Things went just fine for all my WordPress ...
0
votes
1answer
22 views

Drush sql-sync failing with Ubuntu 14.04

I'm having no luck with sql-sync, there's two seemingly unrelated errors it's throwing at me which I'll detail below. I've been successfully sql-sync'ing the same site to another server, so I'm ...
0
votes
0answers
15 views

Cleaning database after Import

I imported millions of nodes (ca. 3 Millions) but i needed to abort sometimes and continue the Import. (like RAM resources) The Import is correct but i did a look into Drupal 7 Database and saw that i ...
0
votes
1answer
74 views

Does Drupal 7 support connecting to DB using MySQLi?

I have tried to connect to Mysql DB using Mysqli by declaring 'driver' => 'mysqli' inside DB array in settings.php but I get the following error: Warning: ...
0
votes
0answers
26 views

Using a different local non-Drupal database to store entities?

So we have a simple mysql database that stores information about people, which is used by multiple sites on our environment. I'd like to use entities to interact with this database, but I can't figure ...
0
votes
1answer
24 views

Migration failed with source plugin exception

I'm getting the following error: Migration failed with source plugin exception Migration failed with source plugin exception: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ...
0
votes
0answers
18 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
16 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
74 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 ...
0
votes
1answer
122 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
36 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
36 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
47 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
63 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
29 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
73 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
20 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
62 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
167 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
34 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
43 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
72 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
102 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 ...
2
votes
1answer
163 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
46 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
44 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
138 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
56 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
64 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
25 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
37 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
30 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
47 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
41 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 ...