Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1096007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:13:01+00:00 2026-05-17T00:13:01+00:00

i want to make my table can filtering in each column. i get client

  • 0

i want to make my table can filtering in each column. i get client side script from DataTable.net. To make this work, i must make change at server side script for this datatable. My table fields is: Line, Model_name, Version, Lot, Serial_number, ID_number, Lot_no_S_Serial, and Prod_date.

i have tried to syncronizing each column to this server script, but i always get an error.
this the following script:

sSearch:
bEscapeRegex:true
sSearch_0:
bEscapeRegex_0:true
bSearchable_0:true
sSearch_1:
bEscapeRegex_1:true
bSearchable_1:true
sSearch_2:
bEscapeRegex_2:true
bSearchable_2:true   //data array same until sSearch_7

EDIT

and this the query:

$sWhere = "";
if (postVar('sSearch') !="" )
{
  $sWhere = " WHERE Line LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%'  ";
}
if (postVar('sSearch_0') !="")
{
  $sWhere = " AND Line LIKE '".mysql_real_escape_string( $_POST['sSearch_0'])."' ";
}
if (postVar('sSearch_1') !="") 
{ 
  $sWhere = " AND Model_name LIKE '%".mysql_real_escape_string( $_POST['sSearch_1'])."%' ";

//until sSearch_7

i’m getting error at this query:

error: “Error occuered during query execution: (): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AND Line LIKE ‘2’ ORDER BY Model_name
desc LIMIT 0, 10′ at line 1”;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:13:01+00:00Added an answer on May 17, 2026 at 12:13 am

    you have to chain your queries.
    while you are replacing $sWhere with each further condition.
    you can use concatenation (.= instead of =), but let me suggest to use array for this:

    $aWhere = array();
    if (postVar('sSearch')) {
      $aWhere[] = "Line LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%'";
    }
    if (postVar('sSearch_0'))
    {
      $aWhere[] = "Line LIKE '".mysql_real_escape_string($_POST['sSearch_0'])."'";
    }
    if (postVar('sSearch_1')) 
    { 
      $aWhere = "Model_name LIKE '%".mysql_real_escape_string( $_POST['sSearch_1'])."%'";
    }
    //and so on
    if (count($aWhere)) $where="WHERE ".implode(' AND ',$aWhere);
    $query="select * from table $where";
    mysql_query($query) or trigger_error(mysql_error().": ".$query);
    

    the last line of this code will print out not only error message but also query itself which will be extremely helpful

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I make some table use DataTable. I make this table can filtering data from
I've got a column in a table (eg. UserName) which I want to make
I want to make sure people can't type the name of a PHP script
I want to make a table, and then for each 6 rows should have
I have column in a table that allow null but i want to make
If all tables I want to delete from have the column gamer_id can i
How can i fetch column names from a table on index basis, like I
I want to make a table of orders, for each row there's an arrow
I want make query select all names from table 'a' where from table 'b'
I want to make a table in SqlServer that will add, on insert, a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.