Multiple table values in server-side processing

Multiple table values in server-side processing

shelleyshelley Posts: 5Questions: 0Answers: 0
edited June 2011 in DataTables 1.8

I am using the latest Datatables1.8.

<b>Question 1</b>
<br>

I am using the server side processing script and need to include multiple tables in my query (server_processing.php). I am currently using the following query (only relevant parts)
<br>

$aColumns = array('User_ID','UID', 'First_Name','Last_Name','City','State','Country','Email', 'Date_Expire','Status','User_Group');
<br>
$sIndexColumn = "User_ID";
<br>
$sTable = "user ";
<br>
$gaSql['user'] = "$user";
<br>
$gaSql['password'] = "$pw";
<br>
$gaSql['db'] = "$db";
<br>
$gaSql['server'] = "$server";

<br>
/**SQL queries Get data to display*/
<br>
$sQuery = "SELECT SQL_CALC_FOUND_ROWS u.User_ID, u.UID,u.First_Name, u.Last_Name, u.City, u.State, u.Country,u.Email,u.Date_Expire,u.Status,u.User_Group,u.UID, m.id,m.access FROM user u, testsessions m WHERE u.UID = m.id
<br>
$sWhere
<br>
$sOrder
<br>
$sLimit";
<br>
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
<br>

While using <b>search</b> I am getting json error as by default (in server-side code example) $sWhere is constructed based on $aColumns array that contains only field names, so when you begin live search you get SQL error (and the page stops responding)..

Please, How can I correct it????????

<b>Question 2</b>
<br>

I need to link two tables as can been seen from the above query. But I am unable to use the following query in $aColumns
<br>
$aColumns = array('u.User_ID','u.UID', 'u.First_Name','u.Last_Name','u.City','u.State','u.Country','u.Email', 'u.Date_Expire','u.Status','u.User_Group','m.access');
<br>
$sIndexColumn = "User_ID";
<br>
$sTable = "user u, sessions m ";
<br>

As I am getting json error??? <b>Why is it not possible to add multiple tables in $aColumns array ??</b> I am unable to use the format u.User_ID ???? How is it possible??

I am a datatables newbie and I request you to provide a resolution to my issue....I searched and the two posts I am able to find was:
<br>
http://datatables.net/forums/discussion/4215/x&page=1
<br>
http://datatables.net/forums/discussion/2774/x

In the first post the working code was removed???? Please help me.....

Shelley

Replies

  • shelleyshelley Posts: 5Questions: 0Answers: 0
    Will I get an answer for this ???????
  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    If you need an answer urgently there is the 'Support' link at the top of every page. As you will note from the number of questions in the forum it is simply impossible for me to answer every question. Bumping questions and cross posting won't help you get an answer.

    With your first question - I don't really understand I'm afraid. You say you get an SQL error - it would very useful if you could show what the SQL error is if I am to have any chance of helping.

    > Why is it not possible to add multiple tables in $aColumns array ?? I

    It is possible and has been shown as possible in this forum a number of times - search for "SQL join" in the search bar.

    It should also be noted that the code is designed to be customised - I can't possibly code the demo code for all possibilities - so you'll likely need to do at least a little bit of integration and customisation work on it. Indeed the information is available in the documentation for you to provide your own server-side processing script.

    Allan
  • shelleyshelley Posts: 5Questions: 0Answers: 0
    edited June 2011
    @allan I am sorry and I was not aware of another Paid support option. Regarding my first question this post is similar:

    http://datatables.net/forums/discussion/2774/x&page=1

    The search option won't work after we change $sQuery as mentioned...There is no documentation provided for using multiple tables in server side processing...
  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Can you show me the SQL statement that is being run against the server please and the error?

    And you are correct there is no documentation for the multiple tables in server-side processing since I only have a limited amount of time to write documentation, provide support and develop DataTables. It is possible to do, but as noted you'll need to make some modifications to the script.

    Allan
  • shelleyshelley Posts: 5Questions: 0Answers: 0
    edited June 2011
    I have provided all the SQL in my first post itself...

    I could understand your situation...but the server side processing php script should have been properly commented as to multiple table use....Multiple tables will be used by most of the users...and some the working code in some posts has been removed...I am unable to understand why?????

    I got the required help from another website by Kae Verens..Hundred times better than the provided server processing script and better explanation...

    Anyway thanks for a wonderful plugin!!!
This discussion has been closed.