sql

test

  1. SELECT * FROM users;

Fix for Same field names in query need aliasing to differentiate :-)

  1. /**
  2.  * Because the field names are both called 'name', this is why the results are borked.
  3.  * By aliasing the fieldnames, the problem is circumvented:
  4.  * e.g.

Same field names in query need aliasing to differentiate :-)

  1. function qube_companies_per_role($roles = ''){
  2.   $result = db_query("SELECT r.name, d.name
  3.    FROM {role} r, {term_data} d, {term_access} a
  4.    WHERE d.vid = 1
  5.    AND a.rid = r.rid
  6.    AND a.ti

Overriding sql

  1. SELECT aggregator_item.iid AS iid,
  2. aggregator_item.title AS aggregator_item_title,
  3. aggregator_item.link AS aggregator_item_link,
  4. aggregator_item.timestamp AS aggregator_item_timestamp
  5. FROM agg

Fix for code for gor to see

  1. function client_search_result($sstr = NULL) {
  2.  
  3.   if (!$sstr) {
  4.       drupal_set_message("Search cant be empty", error);
  5.       drupal_goto('clients');
  6.   } else {
  7.  
  8.   $query = "SELECT * FROM {clie

unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

  1. $result = db_query("INSERT INTO {nom_temp}
  2.        (usr_email,usr_fname,usr_lname,usr_state,usr_verification, usr_hash,    nom_email, nom_fname, nom_lname, nom_state, nom_verification, nom_hash)
  3.  

SQL file glue script for dad

  1. #!/usr/bin/env python
  2.  
  3. # Author: Ben Bradley - bbradley406@gmail.com
  4. # Program for making some changes to a sql file, i dunno
  5.  
  6.  
  7. import sys
  8.  
  9. def ioerror(reason=None):
  10.         '''
  11.         Used to clean up w

Views groupby, the hard way

  1. /**
  2.  * Implementation of hook_views_pre_execute().
  3.  */
  4. function mymodule_views_pre_execute(&$view) {
  5.   if ($view->name == "admin" &&  $view->current_display == "page_1") {
  6.  
  7.     // Manually add a

db_rewrite_sql for filtering on CCK type

  1. /**
  2.  * Rewrite search query to search only show results where
  3.  * the "status" CCK field is "approved"
  4.  */

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)
Syndicate content