saving data in database

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
7620
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Feb 23, 2008 4:10 pm

saving data in database

Post by 7620 » Thu Mar 13, 2008 12:26 pm

i am having problem while saving data into database from a form.
whenever i try to save the data it shows the following error



Fatal error: Call to a member function bind() on a non-object in d:\wamp\www\Joomla\administrator\components\com_hello\admin.hello.php on line 49


save function definition is as follows.



function saveHello(){
global $mainframe;
$row =& JTable::getInstance('hello', 'Table');
if(!$row->bind(JRequest::get('post')))
{
JError::raiseError(500, $row->getError() );
}
$row->message = JRequest::getVar( 'message', '','post', 'string', JREQUEST_ALLOWRAW );

if(!$row->store()){
JError::raiseError(500, $row->getError() );
}
$mainframe->redirect('index.php?option=com_hello', 'Message Saved');
}



14 views still no reply!!!!!!!!!!
nybody pls help!
this code is not the original one that i hav used. this one is from a tutorial about saving data into the database.

radiant_tech
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Sat Dec 15, 2007 3:02 pm
Location: Washington DC Metro

Re: saving data in database

Post by radiant_tech » Sat Mar 15, 2008 3:24 pm

The error would indicate that it expects $row to be an object, but it is not.
Have you included the tables subdirectory and related table file in your component?
Denise


Post Reply