<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Another option is using the CCK API to dynamically determine the table info for a given field.<div><br></div><div>drewish has a great article on it at&nbsp;<a href="http://drewish.com/content/2010/06/correctly_accessing_cck_fields_in_sql_queries">http://drewish.com/content/2010/06/correctly_accessing_cck_fields_in_sql_queries</a>, and a tool to help you determine the correct values to use at&nbsp;<a href="http://drewish.com/tools/cck-query">http://drewish.com/tools/cck-query</a>.</div><div><br></div><div>Steve<br><div><br><div><div>On Sep 15, 2011, at 6:55 PM, Shai Gluskin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Marty,<div><br></div><div>Views module. It's a dynamic query builder. It is very, very smart.</div><div><br></div><div><a href="http://drupal.org/project/views">http://drupal.org/project/views</a></div><div><br></div><div>
As a coder you might find yourself working hard to get out of the way of Drupal and its ecosystem of modules.</div><div><br></div><div>Take out your coder chops on writing a new module for contrib, not on writing custom code for a client project.</div>
<div><br></div><div>best,</div><div><br></div><div>Shai<br><br><div class="gmail_quote">On Thu, Sep 15, 2011 at 9:43 PM, Marty Landman <span dir="ltr">&lt;<a href="mailto:mlandman@face2interface.com">mlandman@face2interface.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I just ran into a Drupal gotcha. Here's the situation. I coded db<br>
queries for nodes and blocks using the hard-coded field file_path<br>
which is part of the content-type story-image. My queries referenced<br>
content_type_story_image.field_story_file_path_value and it was working fine.<br>
<br>
However today I added a second content type, fairy-tale-image which<br>
as one of its fields uses the existing field file_path. This caused<br>
the file_path field to move into its own table,<br>
content_field_file_path. Now I've changed the queries but am thinking<br>
there must be a more intelligent way I could've done these queries,<br>
like going through Drupal's api and not getting caught on this snag.<br>
<br>
Can anyone point me in the right direction to learn how to do that?<br>
<br>
Marty<br>
<br>
--<br>
<a href="http://drupal.org/project/personal_notes" target="_blank">http://drupal.org/project/personal_notes</a><br>
<a href="https://addons.mozilla.org/af/firefox/addon/181910/" target="_blank">https://addons.mozilla.org/af/firefox/addon/181910/</a><br>
<font color="#888888"><br>
--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</font></blockquote></div><br></div>
-- <br>[ Drupal support list | <a href="http://lists.drupal.org/">http://lists.drupal.org/</a> ]</blockquote></div><br></div></div></body></html>