mysql

importing users into a database with auto_increment still enabled with PRIMARY KEY and all

  1.     /* Where the total number of members in the database is 279, when importing the db, do the red stuff at the bottom:*/
  2.  
  3. DROP TABLE IF EXISTS `users`;
  4. CREATE TABLE IF NOT EXISTS `users` (
  5.   `uid

WSOD error from menu_execute_active_handler() - on homepage (using Panels

  1. menu_execute_active_handler(): returned NULL - it's very bad!
  2. WSOD detected!

Shell script for taking a copy of a remote database to your local machine.

  1. if [ $1 = "--help" ];
  2.   then
  3.     echo "
  4.   #########
  5.   # USAGE #
  6.   #########
  7.  
  8.   Syntax for running this script is:
  9.     ./devdb2localdb.sh sshuser sshdomain remotedatabaseuser databasename

MySQL problem

  1. SELECT DISTINCT(node.nid), comments.timestamp AS comments_timestamp_timestamp, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN comments comments ON node.nid = comments.

Working NOT EXISTS sql query

  1. #this query now works. It shows me all vehicles which are available on a particular day
  2.  
  3. SELECT node.nid AS nid,
  4. node.title AS title
  5. FROM node
  6. WHERE (node.STATUS <> 0)

EXISTS vs NOT EXISTS as a sql query

  1. # I have 3 vehicle nodes: 3, 26, 28. The following query should return ONLY nid 3, but it returns 3, 26, 28.
  2.  
  3. SELECT node.nid AS nid
  4. FROM node

Showing vehicle nodes which don't exist in vehicle_booking nodes

  1. #this SQL query has 2 parts. Part 1 shows all vehicles and vehicle bookings nodes (both are CCK types). This returns 4 rows (3 vehicles + 1 vehicle booking)
  2.  
  3. SELECT node.nid AS nid,

Fix for Create a Node from a another Mysql DB Data

  1. <?php
  2. //exec("/usr/bin/clear");
  3. include_once('includes/bootstrap.inc');
  4. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  5. bootstrap_invoke_all('init');
  6. ini_set('memory_limit', '512M');

Number of nodes of specific type created since last login

  1. SELECT COUNT(1) FROM {nodes} n
  2. WHERE n.created > (SELECT login FROM {users} u WHERE uid = %d)
  3. AND n.type = '%s'

Problem with views, block and nodequeue

  1. SELECT COUNT(*) FROM (
  2.         SELECT node.nid AS nid
  3.         FROM node node
  4.         INNER JOIN nodequeue_nodes nodequeue_nodes_node
  5.                 ON node.nid = nodequeue_nodes_node.nid
  6.                 AND nodequeue_nodes_node.qid = 1
Syndicate content