Generally exclude rows in server sided script

Generally exclude rows in server sided script

ThalliusThallius Posts: 31Questions: 4Answers: 0
edited August 2013 in General
Hi,

I have a mysql database which contains adresses. These Adresses have a data field "type" which specfies to whom the address is visible.
How can I change the server sided php script from the datatable example to have a general additional WHERE type='xxx' to get only the addresses which are applied to the user?

Thanks

Claus

Replies

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

    Assuming the script is this one ( http://datatables.net/development/server-side/php_mysql ), I would normally add a little bit around line 131:

    [code]
    if ( $where ) {
    $where .= ' AND type = xxx';
    }
    else {
    $where = 'WHERE type = xxx';
    }
    [/code]

    Regards,
    Allan
  • ThalliusThallius Posts: 31Questions: 4Answers: 0
    I did it that way but you also have to insert the WHERE statement in the totalResult query.

    Claus
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Oops - yes - I'd forgotten about that. Thanks for noting that!

    Allan
This discussion has been closed.