Server-side AJAX PHP: add an extra field
Server-side AJAX PHP: add an extra field
szakendre
Posts: 24Questions: 10Answers: 0
Hello,
I use the datatable with PHP database backend.
JavaScript:
ajax:
{
url: 'ajax/users.php',
type: "POST",
data: function ( d )
{
d.GLOBAL_userid = <?php print $_SESSION['usersid']; ?>;
}
},
...
columns: [
{
"data": "username"
},
PHP:
$editor = Editor::inst( $db, 'users', 'id' )
->fields(
Field::inst( 'username' ),
How can I add an extra column to this that doesn't come from database?
If I just make a new field it said: "Table part of the field was not found."
Thank you and best regards:
Endre, Szak
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Just alias an existing database column and return whatever you want. Just like in here: updaterName and creatorName are not in the database. Make sure to use ->set( false ) for the aliased columns.
It's not official yet, but you're a genius!
Thank you! Mercy! Köszönöm! Danke Schön!
How can I thank you?
Just by writing what you wrote... Köszönöm for that. Greetings to Hungary. Haven't been to Budapest in a long time!