Questions tagged [drupal-database]

Drupal provides a standard, vendor-agnostic abstraction layer for accessing database servers.

The Drupal 7 Database API provides a standard, vendor-agnostic abstraction layer for accessing database servers. The API is designed to preserve the syntax and power of SQL as much as possible, but also to:

  • Support multiple database servers easily
  • Allow developers to leverage more complex functionality, such as transactions
  • Provide a structured interface for the dynamic construction of queries
  • Enforce security checks and other good practices
  • Provide modules with a clean interface for intercepting and modifying a site's queries

Further resources

21 questions
0
votes
4 answers

Convert SQL query into Drupal 7 PHP rules

SELECT address FROM user_address WHERE username = '$user->name' ORDER BY time DESC LIMIT 1 Here is the SQL query that I can understand. How is it possible to convert it into Drupal's 7 PHP? I'm trying to figure that out for a day, and I tried…
querydb
  • 3
  • 3
0
votes
1 answer

fetching taxonomy tree from database from query

I add a vocablary named "product sub categories" and I want to fetch the whole tree structure from datebase through query? Can anybody can help me?
nomeer
  • 205
  • 3
  • 13
0
votes
1 answer

how to select query from drupal 7

i have this query on drupal 6 $catq=' ( SELECT term_node.nid as node_id FROM {term_node} WHERE tid='.$catint.') as cat, ' i have upgrade it like this $query=db_select('term_node'); ->addfield('term_node', 'nid', 'node'); …
Dewitt
  • 1
  • 1
0
votes
1 answer

drupal 7 sort query results with db_query syntax error

I want to get all the comments for certain node, i use db_query. that works fine. But i can not order it by created time. I got PHP Parse error: syntax error, unexpected T_STRING $results = db_query('SELECT c.nid,c.name, c.uid, c.subject, c.created…
user3210341
  • 77
  • 1
  • 2
  • 14
0
votes
2 answers

best practice of form page using drupal 7

Im really newbie with drupal 7 and I want to tests things with it: I want to build a form page that will get information from users. for example workes that input FIRSTNAME, LASTNAME ID, PHONENUMBER and etc.. after that they will submit and it will…
Dor Zohar
  • 199
  • 1
  • 3
  • 11
0
votes
1 answer

Does Drupal node_load lock the Node and Related Fields?

I'm in Drupal 7 and implementing custom script inside Drupal Root folder. Then i'm trying to call-up a node with node_load(1234) and then node_save($node). Between this two methods, i'm trying to DELETE some records (some DB Rows). But i can not…
夏期劇場
  • 17,821
  • 44
  • 135
  • 217
1
2