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

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin

    Hi,

    Could you try this version of the SSP class please?

    That should hopefully resolve the error.

    Allan

  • edf0edf0 Posts: 1Questions: 0Answers: 0

    Esa version de SSP class si funciona, gracias

  • Rutvi_222Rutvi_222 Posts: 1Questions: 0Answers: 0

    "I just have to express my immense gratitude for the latest version of ssp.class.php. It's been a game-changer! After struggling for two days with the older version, I was at my wit's end with those errors. But this new version? It's like a breath of fresh air! Thank you for saving me from that headache and making my coding life so much smoother!"

    Thank you once again...

Sign In or Register to comment.