You are here

function answers_answersapi in Answers 5.2

2 calls to answers_answersapi()
answers_form_alter in ./answers.module
simpleanswer_view in simpleanswer/simpleanswer.module

File

./answers.module, line 408
Enables the creation of question nodes that can be answered by posting answer nodes.

Code

function answers_answersapi($op, $nid) {
  switch ($op) {
    case 'question':
      $tresult = db_query('SELECT a.qid FROM {answers} a WHERE a.nid = "%d"', $nid);
      while ($res = db_fetch_object($tresult)) {
        return $res->qid;
      }
      break;
    case 'answerlink':
      $tresult = db_query('SELECT a.qid FROM {answers} a WHERE a.nid = "%d"', $nid);
      while ($res = db_fetch_object($tresult)) {
        return $res->qid;
      }
      break;
    case 'qtitle':
      $tresult = db_query('SELECT n.title FROM {node} n, {answers} a WHERE a.qid = n.nid AND a.nid = "%d"', $nid);
      while ($res = db_fetch_object($tresult)) {
        return $res->title;
      }
      break;
    case 'theone':
      break;
  }
}