two or more left join

two or more left join

acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0
edited September 2014 in DataTables 1.10

Hi,
How can create two left join in one SELECT ?

I tried with this ... but not works

$out = Editor::inst( $db, 'tickets' )
    ->field( 
        Field::inst( 'tickets.ddate' ),
        Field::inst( 'tickets.vdescription' ),
        Field::inst( 'tickets.id_member'),
        Field::inst( 'members.vusername' ),
        Field::inst( 'companies.vcompany' ),
    )

    ->leftJoin( 'members', 'members.id', '=', 'tickets.id_member' )
    ->leftJoin( 'companies', 'companies.id', '=', 'tickets.id_company' )

    ->process($_POST)
    ->data();

thanks
Antonello

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi Antonello,

    Thanks for your question and the code. What you have above should work - you can see an example here which uses the same approach as you have above.

    When you say it doesn't work, do you get an error reported? If so, what is the error?

    Many thanks,
    Allan

  • acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

    hello Allan,

    this is the error on dialog:

    DataTables warning: table id=example - Ajax error. For more information about this error, please see http://datatables.net/tn/7

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you follow the instructions in the tech note that the error message links to - what is in the Ajax return from the server? Alternatively, you could use the DataTables debugger which should also give me the information required.

    Regards,
    Allan

  • acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

    I use DataTables debugger .. the code is: olixan

    it correct ?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Yes - that's great thanks. However, it would appear that the server's error reporting configuration is stopping it from reporting errors to the client-side. That is good (better for security), but it makes debugging a little bit harder!

    Do you have access to the server's error logs? If you take a look at the error log it should show an error which will give us the information we need to resolve the issue.

    At the moment the server is responding with 500 Internal Server Error to the Ajax request and returning no data.

    Allan

  • acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

    I use MAMP on my macbook pro...

    oh my god ! .... In the logs there are stupid errors ..( see below )

    thanks Allan ... you are amazing !

    PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /Users/acarlomagno/Documents/Developer/httpdocs/DataTables-1.10.2/extensions/Editor-1.3.2/examples/php/joinSelf_portal_ticket.php on line 31

    PHP Parse error: syntax error, unexpected ';' in /Users/acarlomagno/Documents/Developer/httpdocs/DataTables-1.10.2/extensions/Editor-1.3.2/examples/php/joinSelf_portal_ticket.php on line 36

  • acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

    ok ... but If I want to insert a WHERE condition ?

  • acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

    solved...
    ->where($key = 'vusername', $value = 'acarlomagno', $op = '=' )

    thanks

This discussion has been closed.