Server side with SSP::complex

Server side with SSP::complex

taouktaouk Posts: 1Questions: 0Answers: 0

Description of problem:
I tried complex method with SSP class and i was getting
"DataTables warning: table id=example - An SQL error occurred: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens"

I finally solve this by changing the method code.

Instead of the original lines:
$resTotalLength = self::sql_exec($db, $bindings,
"SELECT COUNT({$primaryKey})
FROM $table " .
$whereAllSql
);
$recordsTotal = $resTotalLength[0][0]

It work with the syntax of simple method:
$resTotalLength = self::sql_exec($db,
"SELECT COUNT({$primaryKey})
FROM $table"
);
$recordsTotal = $resTotalLength[0][0];

(without $whereAllSql)

Its OK for me. I can use it in my project, but i wonder if i am missing something

My call is
ech o json_encode(
MY_SSP::complex( $_GET, $sql_connection, $table, $primaryKey, $columns, $whereResult="", "school_id = '$user_id'" )
);

Where school_id is table column

Replies

Sign In or Register to comment.