Fatal error: Call to a member function transaction() on a non-object in ...
Fatal error: Call to a member function transaction() on a non-object in ...
Hi,
I have this error : Fatal error: Call to a member function transaction() on a non-object in ...
Can someone help me to fix this error?
My server source :
<?php
// DataTables PHP library
include("php/DataTables.php");
$table = 'myTable';
$db='myDB';
$primaryKey = "PrimaryKey";
$columns = array(
array( 'db' => 'id_ligne','dt' => 0 ),
array( 'db' => 'direction','dt' => 1 ),
array( 'db' => 'service','dt' => 2 ),
array( 'db' => 'fonction','dt' => 3 ),
array( 'db' => 'attribution','dt' => 4 ),
array( 'db' => 'numero', 'dt' => 5 ),
array( 'db' => 'materiel', 'dt' => 6 ),
array( 'db' => 'forfait', 'dt' => 7 ),
array( 'db' => 'options', 'dt' => 8 ),
array(
'db' => 'date_debut',
'dt' => 9,
'formatter' => function( $d, $row ) {
return date( 'd/m/y', strtotime($d));
}
),
array(
'db' => 'date_reforme',
'dt' => 10,
'formatter' => function( $d, $row ) {
return date( 'd/m/y', strtotime($d));
}
),
array( 'db' => 'reforme', 'dt' => 11 ),
array( 'db' => 'commentaire', 'dt' => 12 )
);
// SQL server connection information
$sql_details = array(
'user' => 'userName',
'pass' => 'password',
'db' => 'myDB',
'host' => 'localhost'
);
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'myTable')
->fields(
Field::inst( 'id_ligne' ),
Field::inst( 'direction' ),
Field::inst( 'service' ),
Field::inst( 'fonction' ),
Field::inst( 'attribution' ),
Field::inst( 'numero' ),
Field::inst( 'materiel' ),
Field::inst( 'forfait' ),
Field::inst( 'options' ),
Field::inst( 'date_debut' ),
Field::inst( 'date_reforme' ),
Field::inst( 'reforme' ),
Field::inst( 'commentaire' )
)
->process( $_POST )
->json();
Thanks for your help.
Replies
Looks like you are attempting to use both the
SSP
class and the Editor classes. Just use one - Use Editor if you are using Editor on the client-side.The specific issue you are seeing is because you are making the
$db
a string while theEditor
class is expecting aDatabase
class instance.Remove the SSP stuff and you should be okay.
Allan
It's okay, i already fixed the problem, thanks you Allan.
I have another error, Editor buttons (New, Edit, Delete) and search won't work. (even function like "rowCallback")
I send you my script :
``
var editor;
$(document).ready(function() {
/* $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.inline( table.cell( this ).index(), {
onBlur: 'submit'
} );
} );*/
} );``
My import too :
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript" language="javascript" src="js/dataTables.buttons.min.js"></script>
<script type="text/javascript" language="javascript" src="js/buttons.bootstrap4.min.js"></script>
<script type="text/javascript" language="javascript" src="js/dataTables.select.min.js"></script>
<script type="text/javascript" src="js/dataTables.editor.min.js"></script>
<script type="text/javascript" src="js/editor.bootstrap4.min.js"></script>
Thanks you a lot for your help.
Can you give me a link to the page showing the issue please? That looks like it should work okay.
Allan
This is a link where you can see a screen of the different problems :
https://ibb.co/gfUtS8
Case Search = Test don't do anything,
TypeError: c(...).one(...).appendTo(...).modal is not a function. When i click new Button, Edit or Delete.
(Select a line works)
More over, i don't understant why my table is not order by ID ( i guess that my script isn't fully used)
Thanks again.
Edit :
Below my table : Showing 0 to 0 of 0 entries (filtered from NaN total entries)
I import
that fix my editor buttons.
Need responses for search, pagination, and modification in database please.
Regards.
I'd really need a link to a page showing the issue I'm afraid. Have you included the Bootstrap 4 Javascript on your page?
Allan
Hi,
I started from scratch again and i solved my problems.
I think it was a file tree problem.
Thanks anyway for your help and availability!