Jump to content

Recommended Posts

//please dont talk about sql injection, i'll work on it, the problem with this code, it count all entries in a database table but i wantto count only with nid = 1
$query = 'SELECT * FROM abc WHERE nid = 
if(!empty($_POST["search"]["value"])){
$query .= 'AND (a LIKE "%'.$_POST["search"]["value"].'%" 
OR b LIKE "%'.$_POST["search"]["value"].'%" 
OR c LIKE "%'.$_POST["search"]["value"].'%") ';      
} 
if(!empty($_POST["order"])){
            $query .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
        } else {
            $query .= 'ORDER BY id DESC ';
        }
        if($_POST["length"] != -1){
            $query .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
        }   
        $result = mysqli_query(dbConnect, $query);

 

23 minutes ago, Barand said:

First thing you should do is turn on error reporting and clear all your syntax errors. Then you can worry about getting the query right.

 

AWESOME SOLUTION THANKS, SOLVED, IT WAS A SYNTAX IN MY PHP SCRIPT, I CHECKED IN ERROR LOG

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.