This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

get field names for table

I'm quite new to drupal (and PHP) but already starting to like it a lot!

To learn the internals I started poking around inside the ecomerce module and found this

/**
 * The names of the database columns in the table.
 */
function product_fields($table = 'ec_product') {
  return array('nid', 'sku', 'price', 'is_recurring', 'price_interval', 'price_unit', 'price_cycle', 'auto_charge', 'ptype', 'hide_cart_link');
}

If prefer to make these kind of things automatic. After reading this I put together the following function:

function my_db_get_table_field_names($table) {
  // Druplifed version of solution found at:
  //       http://se2.php.net/manual/en/function.mysql-list-fields.php

  $sql = "SHOW COLUMNS FROM `$table`";
  $field_names = array();
  $result = db_query($sql);

 for($i=0;$i<db_num_rows($result);$i++){
   $row = db_fetch_array($result);
   $name = $row['Field'];
   array_push($field_names, $name);
  }
  
 return $field_names;
}

I've tried to search drupal.org to see if there is something similar already in Drupal but couldn't find anything.

Is this something people would like to have in future versions of database.mysql.inc? If not, what is the best way for me to assemble a library of useful functions - is it a module or a .inc-fi

podcasting migration module

I'm trying to write a podcat migration module enabling easy site transitions for bloggers/podcasters.
I need to somehow parse a remoted feed store the data in some kind of data structure and utilize the audio module to create viable audio nodes.
Any idea on which modules can assist me on getting ideas for the implementation?
Anything I'm missing? Aggregator stores the data in the db in it's parse_feed function - any other directions?

Lior.

event when creating a new account

I want to write an istruction when Drupal create a new account. Where I have to insert it? For example, if I'm registering a new account, before to create a new account and say it is ok Drupal has to inserts values in a my Mysql table.
Thanks

Internationalization in 4.7 - Beta 2?

Hi,

does anybody know if it's safe to use the 4.6 i18n module with the 4.7 Beata 2? If not is there a 4.7 version of i18n yet? I couldn't find one anywhere.

Thx, Felix

input format , flexinode!

Hello

Happy new year all

I have my website installed and work fine, i add a new content with flexinode and i add new content, content type and some textarea field, with evey textarea added i have the input format check boxes when user want to post, how to hide the input format to use only with one textarea field not for everyone !!

Thanks

Feeling lost trying to contribute a module :-?

Hi!

I'm trying to create a new module, but I'm feeling lost. I've read the FAQ.txt and README.txt documents as well as all relevant handbooks, well I think.

A few days ago I sent a CVS account request and I just got an email telling me "your CVS account request has been sent to the CVS administrators and will be processed as time permits". Since I haven't got any other feedback I assumed I could try to proceed with the next step.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions