Hi,
I'm trying to write to two tables, jos_content, and also jos_jreviews_content (the second one needs the lastid to get the contentid or id as its called in jos_content.
Throwing a lot of errors back when trying to write to jos_content using queries, so i tried to copy the autogenerated code accross from the submitcontent example download, into the form code submit before email on my form.
it comes back with:
do i need to include the fields into the code? i assumed as they are already named correctly in post data i wouldnt need to . Although they are amoungst a lot of other fields that will be used for the jreviews table.
Any idea what i might have missed?
I'm trying to write to two tables, jos_content, and also jos_jreviews_content (the second one needs the lastid to get the contentid or id as its called in jos_content.
Throwing a lot of errors back when trying to write to jos_content using queries, so i tried to copy the autogenerated code accross from the submitcontent example download, into the form code submit before email on my form.
$_POST['catid'] = '9';
$_POST['id'] = '';
$_POST['sectionid'] = '3';
$_POST['state'] = '0';
$_POST['created'] = date("Y-m-d H:i:s");
$MyForm =& CFChronoForm::getInstance();
$user = JFactory::getUser();
$row =& JTable::getInstance("content", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
$MyForm->tablerow["jos_content"] = $row;
$lastId = $row->id;
it comes back with:
Fatal error: Call to a member function bind() on a non-object in /../components/com_chronocontact/libraries/customcode.php(61) : eval()'d code on line 30
do i need to include the fields into the code? i assumed as they are already named correctly in post data i wouldnt need to . Although they are amoungst a lot of other fields that will be used for the jreviews table.
Any idea what i might have missed?