0

Maybe it's a stupid question, but I can't reach an answer. There's a limit to showing rows when I use the sql command "Select * from table order by id asc limit 0,X"?

Because I'm working with a script that using it and I don't have problems until 700 rows. If I want limit 800 rows, for example, I can't see any data and error_log says "Undefined index".

$sql = "SELECT id,email,nome,cognome,lingua,unsubscribe ";
$sql.=" FROM newsletter_utenti WHERE 1=1";
if( !empty($requestData['search']['value']) ) {
    $sql.=" AND ( id LIKE '".$requestData['search']['value']."%' ";
    $sql.=" OR email LIKE '".$requestData['search']['value']."%' ";
    $sql.=" OR nome LIKE '".$requestData['search']['value']."%' ";
    $sql.=" OR cognome LIKE '".$requestData['search']['value']."%' ";
    $sql.=" OR lingua LIKE '".$requestData['search']['value']."%' )";
}
$query=mysqli_query($db, $sql) or die("errore filtro");
$totalFiltered = mysqli_num_rows($query);
$sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]."   ".$requestData['order'][0]['dir']."  LIMIT ".$requestData['start']." ,".$requestData['length']."   ";
$query=mysqli_query($db, $sql) or die("order by error");

The problem it's referred to my previous post: DataTable server side works only when I have a few data

I thought there're two different issues so I've opened the second post.

Thank you

Community
  • 1
  • 1
Otto
  • 119
  • 3
  • 12
  • No limit to `limit`, no. Must be something else. – juergen d Oct 19 '16 at 14:44
  • It's refered to this post: http://stackoverflow.com/questions/40132194/datatable-server-side-works-only-when-i-have-a-few-data?noredirect=1#comment67534966_40132194 – Otto Oct 19 '16 at 14:45
  • 1
    What if you remove the limit from the query. Will it perform with or without error? – Woozar Oct 19 '16 at 14:46
  • It performs with error: "PHP Notice: Undefined index: draw". Referred to this post: http://stackoverflow.com/questions/40132194/datatable-server-side-works-only-when-i-have-a-few-data – Otto Oct 19 '16 at 14:48
  • Sounds like a PHP error and not a MySQL error, so do revise your question with relevant code (and tags). – apokryfos Oct 19 '16 at 14:50
  • Really? :( ok, i've edited my post – Otto Oct 19 '16 at 14:52
  • show the actual query string that results if you are doing a concat (var_dump) – Drew Oct 19 '16 at 14:54
  • It's incomplete... string(107) "SELECT id,email,nome,cognome,lingua,unsubscribe FROM newsletter_utenti WHERE 1=1 ORDER BY LIMIT , " – Otto Oct 19 '16 at 15:07

1 Answers1

0

Solved!

The MySQL instance is not configured to expect UTF-8 encoding by default from client connections, so I used SET NAMES utf8.

Thank you all! :)

Otto
  • 119
  • 3
  • 12