Get KoolPHP UI with 30% OFF!

MySqliDataSource : Result check needed and other minor issues that fill up PHP error log.

Anthony Amolochitis
I experience the following warnings:
Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\order\KoolPHP\KoolControls\KoolGrid\ext\datasources\MySQLiDataSource.php on line 34
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\order\KoolPHP\KoolControls\KoolGrid\ext\datasources\MySQLiDataSource.php on line 102
Warning: mysqli_query(): Empty query in C:\wamp\www\order\KoolPHP\KoolControls\KoolGrid\ext\datasources\MySQLiDataSource.php on line 196
On line 34 I the sql that was generated was :
SELECT COUNT(*) FROM
( SELECT *, CONCAT(custcontact, contact_title, email ) ContactSearchData FROM leadtrackusers.custcontact WHERE custid = '635' ORDER BY is_deleted, custcontact ; )
AS _TMP
Removing the semicolon fixed the issue.
$_result = mysqli_query($this->_Link, str_replace(';',' ', $_count_command) ); // remove the semicolon

The error on line 102 had a select command like this.
"SELECT * FROM
( SELECT *, CONCAT(custcontact, contact_title, email ) ContactSearchData FROM leadtrackusers.custcontact WHERE custid = '635' ORDER BY is_deleted, custcontact ; )
AS _TMP LIMIT 0 , 5"
By removing the ";"
The query worked.
Here is the code I used to fix 102, by altering the code at line 99 to remove the semicolon.
$_result = mysqli_query($this->_Link, str_replace(';', ' ', $_select_command) );  // remove semicolon

On line 196, I just added an empty check
if(  !empty( $_insert_command )  &&  mysqli_query($this->_Link,$_insert_command)==false)
{
	return false;
}

I'm not sure if these are proper fixes for those warnings, but would you guys mind applying the proper fix for future updates. Everytime I upgrade KoolPHP, I have to go fix these bugs.
Thanks guys,
Just so you know, you guys have a great product, and that is why I use it. I hope I am not being a bother, but I am just trying to help keep you guys informed.
Posted Oct 29, 2015 , edited Oct 29, 2015 Kool
David
Hi Anthony,
Thanks for your feedback! May I ask can you just remove the semicolon from the SelectCommand or is there anything else?
Rgds,
Posted Oct 30, 2015 Kool
Anthony Amolochitis
I did remove the semicolon in my version of the update. Will you guys be able to apply a fix to correct the sql syntax for those cases in a future update?
Posted Oct 30, 2015 Kool