We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Hi All
    I am trying to update a custom database table from a web user form when submitted using the following:
    but get the - Call to undefined method DBAPI::getFullTableName() - error msg at line 19.
    The table has no prefix other than the database name.
    $seats = $_POST["seats"];
    
    $places = $_POST["places"];
    
    $sid = $_POST["sessionID"];
    
    $new_seats = $places - $seats;
    
    // ******** UPDATE SESSION PLACES **********
    #################################################################################
    require_once('../manager/includes/config.inc.php');
    require_once('../manager/includes/document.parser.class.inc.php');
    $modx = new DocumentParser;
    
    	$new_seats = update_places($sid, $new_seats);
    
    	function update_places($new_seats) {
            global $modx;
    		$table = $modx->db->getFullTableName('xtra_session');
             
    		$result = $modx->db->update( 'places = "' . $new_seats . '"', $table, 'id = "' . $sid . '"' );
                    return $result;         // Returns 'true' on success, 'false' on failure.
    }


    Any help greatly appreciated.

    This question has been answered by sottwell. See the first response.

    • discuss.answer
      That's not a db object method. Just $modx->getFullTableName.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • Ah, yes thanks for that.