Custom WHERE in storing JTable row in Joomla 1.5

1.3k Views Asked by At

I'm using JTable to store a record in a table. My table has 3 primary keys(pid,eid,sid). I want to store (Insert,update) a record my code:

$row =& JTable::getInstance('mytable', 'Table');
$row->load(
                array(
                    'pid'   =>$pid,
                    'eid'   =>$eid,
                    'sid' =>$sid
                    )
            );
$row->data = $data;
if (!$row->store()) {
                JError::raiseError(500, $row->getError() );
            }

The load function runs with warning: Warning: mysql_real_escape_string() expects parameter 1 to be string, object given in ...\joomla\database\database\mysql.php on line 193

and the store function raise an error:

, but the store raise an error with the SQL statement. The SQL statement contains the field names and new values and 'WHERE' keyword but without a condition.

any help?

1

There are 1 best solutions below

0
On

The load function takes an integer as an input (see here http://docs.joomla.org/JTable/load) so you cannot pass it an array. The integer you pass it should be the primary key of your table. Here you can use any one of your 3 primary keys, because being primary it will be unique.