php list plugin error: TypeError: a is null

error.PNG Guys,

I am trying to use php plugin to update a field in the database but I keep getting this error "TypeError: a is null" via firebug and the database is not updated. The structure of the table is as follows:
Table name = 'test'
Unique id = 'id'
field to update = 'test' (update with the current logged on user_id)

I have checked and re-checked my code but I think its correct. I have also tried to use var_dump() it does not work that well I also have an error there "SyntaxError: missing ) in parenthetical"

I have been on this for hours please help

Here is the code.


$app = JFactory::getApplication();
$ids = $app->input->get('ids', array(), 'array');

$user = JFactory::getUser();
$userid = $user->get('id');

foreach ($ids AS $myid)
{
$row = $model->getRow($myid);
$invoice_id = $row->test___id;

$query = $db->getQuery(true);

// Fields to update.
$fields = array( $db->quoteName('test') . ' = ' . $userid);

// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('id') . ' = 1');

$query->update($db->quoteName('test'))->set($fields)->where($conditions);
$db->setQuery($query);
$result = $db->execute();

}
 
I can't see anything obvious.
But you shouldn't use common variable names like $db, $row etc (although they are sometimes still in the WIKI examples) because they may override the ones used in Fabrik.
So better use $my_db, $x_row ....

For testing php plugins you should set your list to ajaxfied=no (otherwise you'll see errors and debug output only in the Network response) and enable Joomla error reporting (which I think you have already).
Doesn't it show a line number also?
 
When I have Ajax list field as yes firebug point that error to list.js (line2, col 14938)

When I put the Ajax field to "no" and I click on the list button it open to an blank window with the following url "http://smeboost.com/administrator/index.php?resetfilters=0&clearordering=0&clearfilters=0". In this blank window firebug is also blank

I have used different variables in my code instead of the common ones but the database is still not getting updated.

Any other suggestions?
 
If you get a blank window with AJAX off, that means there's a fatal PHP error.

Have you set error reporting in J!'s global settings to "Maximum"?

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top