Php Debug

Php Debug

andreavelloneandreavellone Posts: 46Questions: 13Answers: 2

I have this function

->on('postEdit',function( $editor, $id, $values, $row) {
    global $allValues;
    $allValues = $editor->db()->select( 'movimenti', 'var', [ 'materiale_id' => $row['materiali']['id'] ] )->fetchAll();
    $dispon=array_values($allValues);
    $somma=array_sum($dispon);
    $editor->db()
                ->query('update', 'materiali')
                
                ->set('disponibilita',  $somma )
                ->where('materiali.id', $values['movimenti']['materiale_id'])
                ->exec();
            })

how I can debug? i'd like to see the query and the result.
I can't realize why the sum is 0, i suppose that the result in an array like (3,5,6,..,)
var in an integer...

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Add ->debug( true ) before you call ->process( ... ) and the SQL executed by the Editor DB libraries will be included in the returned JSON.

    Allan

This discussion has been closed.