Hi,

I had a problem that my 1st party form disapeared and on viewing translations, information was missing. When running cron via drush this error ocured:

WD php: Table 'mydatabase.mc_currencies' doesn't exist
query: SELECT * FROM mc_currencies WHERE nid = 230 in
/xxx/sites/all/modules/mutual_credit/mcapi.module on line 187

I am using table prefixes so it seems that the table prefix could not be added properly.

I replaced the code in line 186 and 187:

  $table = $node->type == 'exchange' ? 'mc_exchanges' : 'mc_currencies';
  $fields = db_fetch_array(db_query("SELECT * FROM {$table} WHERE nid = $node->nid"));

with the code from a dev version from 2011-12-20:

if ($node->type == 'exchange') {
    $fields = db_fetch_array(db_query('SELECT * FROM {mc_exchanges} WHERE nid = %d',
      array(':nid' => $node->nid)
    ));
  }
  else {
    $fields = db_fetch_array(db_query('SELECT * FROM {mc_currencies} WHERE nid = %d',
      array(':nid' => $node->nid)
    ));
  }

now everything is working fine but I had to hack this in your module.

Let me know if I am missing something. If not, please make necessary changes so the next update will work.

thanx for your great work! :)

Comments

matslats’s picture

Status: Active » Closed (fixed)

I can't see how your code is different to mine.
But I have copied it and committed it to HEAD.
Note that version 2.5 is released.

danoguru’s picture

I tried this and this works too:

  $table = $node->type == 'exchange' ? 'mc_exchanges' : 'mc_currencies';
  $fields = db_fetch_array(db_query("SELECT * FROM {%s} WHERE nid = %d", $table, $node->nid));