Fatal error: Call to undefined method CForm::fetch()

Discussion in 'Programming' started by badeyes, Aug 13, 2009.

  1. #1
    Please anyone help on this, what's wrong with code as its working fine on Linux hosting and now I have shifted all files to WAMP Server 2.0 with PHP 5.2.8 and Apache 2.0.63

    how to solve this:

    Fatal error: Call to undefined method CForm::fetch() in C:\wamp\www\scripts\report.php on line 65

    CForm.php Code:

    function fetch_element(&$RESULT, $vars) {
    $RESULT['data'] = $vars['field'];
    $RESULT['type'] = "form_".$RESULT['data']['type'];
    $RESULT['data']['title'] = $this->getconst($this->_titles[$RESULT['data']['name']]);
    $RESULT['data']['comment'] = $this->getconst($this->_comments[$RESULT['data']['name']]);
    $RESULT['data']['error'] = $this->getconst($this->_errors[$RESULT['data']['name']]);

    $attribs = '';
    if (isset($RESULT['data']['attribs']))
    foreach ($RESULT['data']['attribs'] as $attr_name=>$attr_value)
    $attribs .= ' '.$attr_name.'="'.$attr_value.'"';
    $RESULT['data']['attributes'] = $attribs;

    $RESULT['parent']['data']['elements'][$RESULT['data']['name']] = $RESULT['data'];
    }

    -----------------------------------------------------
    Report.php code (Line 65):

    $form->fetch($RESULT, 'report_form');
    ------------------------------------------------------

    And Finally hare's report_form strings:

    message Send Report
    site Program:
    link_submit Report Broken Link
    spyware_submit Report Spyware


    I googled it and found 1 solution to switch to PHP 5.2.8 and Apache 2.0.63 from higher version. I switched both it in Wamp Server 2 but still getting this error while all the codes working fine on Linux Hosting.. anyone can help on this?
     
    Last edited: Aug 13, 2009
    badeyes, Aug 13, 2009 IP
  2. jamespv85

    jamespv85 Peon

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    errr your function defines `fetch_element` while you are calling it by the name `fetch` so maybe that is why it's saying undefined method.
     
    jamespv85, Aug 13, 2009 IP
  3. badeyes

    badeyes Active Member

    Messages:
    411
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    oh yeah, some code was missing from php file, thank god I found bakcup of this file and nor everything is working fine :D
     
    badeyes, Aug 13, 2009 IP