Get KoolPHP UI with 30% OFF!

New to Kook Grid

Mark
Folks I am trying to create my first grid using postgres. I am getting the following error.
PHP Fatal error: Call to a member function setcharset() on a non-object in /web/KoolPHPSuite/KoolControls/KoolGrid/koolgrid.php on line 1
I did not order the source code, just the code. It looks like it wants me to set the charset, but I find nothing on this in the doc pages.
Any help would be great.

Thanks
Here is my code.
<?php
//Step 1: Register KoolGrid component to your page
require "../KoolPHPSuite/KoolControls/KoolGrid/koolgrid.php";
require "../KoolPHPSuite/KoolControls/KoolAjax/koolajax.php";
require "../KoolPHPSuite/KoolControls/KoolGrid/ext/datasources/PostgreSQLDataSource.php";
$koolajax->scriptFolder = "../KoolPHPSuite/KoolControls/KoolAjax";
//Step 2: Create datasource
$host = '192.168.56.73';
$db = 'pbs';
$user = 'postgres';
$pass = 'postgres';
$dsn = "host=$host;port=5432;dbname=$db;user=$user;password=$pass";
$db_con = pg_connect("host=$host port=5432 dbname=$db user=$user password=$pass");
$ds = new PostgreSQLDataSource( $db_con );
$ds->SelectCommand = "Select * from event";
//Step 3: Init KoolGrid and settings
$grid = new KoolGrid("grid");
$grid->scriptFolder = "/KoolPHPSuiteKoolControls/KoolGrid";
$grid->styleFolder="default";
$grid->DataSource = $db_con;
$grid->AjaxEnabled = true;
$grid->Width = "655px";
$grid->AllowInserting = true;
$grid->AllowSorting = true;
$grid->AutoGenerateColumns = true;
$grid->MasterTable->Pager = new GridPrevNextAndNumericPager();
//Step 4: Process Grid
$grid->Process();
?>
<html>
<head>
<title></title>
<?php echo $koolajax->Render();?>
</head>
<body>
<form id="form1" method="post">
<!-- Step 5: Get KoolGrid render -->
<?php echo $grid->Render();?>
</form>
</body>
</html>
~
~
Posted Mar 31, 2017 Kool
Anthony Amolochitis
Did you run your query on a test script to see if it returned any results?
Also, the source code option is really nice. I purchased it, and it helps quite a bit.
Posted Mar 31, 2017 , edited Mar 31, 2017 Kool -
Mark
Thanks for your response. It was my hope that you would be the one that responded, I have got a lot of benefit from your other posts that I have read on other topics.
As to your question, I have tested the connection and other PHP code this web server. It works well. The concern I had was it looks like a missing method? This example seems to be very simple and it fails when I try a new instance of the grid.
I have thought about getting the source code, but I wanted to make sure that the code was solid in regards to postgres, I have been burned before. Did not want to shove money down a rat
Posted Mar 31, 2017 Kool
Anthony Amolochitis
See if you get the same error in using mysqli.
Before I had purchased the source code, I used to try other connections to help isolate the problem.
It could be a bug, but attempt to run the test. If it's a bug, the koolphp support people will fix it pretty quickly.
Posted Mar 31, 2017 Kool
Mark
OK I will try soon and let you know. Thanks
Posted Mar 31, 2017 Kool
Mark
OK mysql works.
PDO and Pgsql does not Get the same error...
Postgres
PHP Fatal error: Call to a member function setcharset() on a non-object in /web/KoolPHPSuite/KoolControls/KoolGrid/koolgrid.php on line 1
PDO
PHP Fatal error: Call to undefined method PDO::setcharset() in /web/KoolPHPSuite/KoolControls/KoolGrid/koolgrid.php on line 1
Posted Apr 1, 2017 , edited Apr 1, 2017 Kool
Anthony Amolochitis
Open the koolgrid.php file, and locate the function "setcharset()"
Overwrite the function name as : SetCharSet()
See if that helps.
Posted Apr 1, 2017 Kool
Mark
That is a great idea, but since I do not own the code that is not an option.
This feels like a bug. Since I do not use mysql as our db standard (we are a postgres shop) I am dead in the water. I am guessing that I need to open a ticket. It has been several days now and I need to finish this project that I am on.
Is that the best process or our these boards monitored?
Since I am trying to do the most basic of functions, is this typical of non-mysql support. Are others using this product for non mysql databases? What can be expected moving forward. This is a new product for us and I am wondering what the future holds for us in this choice? Should I be concerned?
Posted Apr 1, 2017 , edited Apr 1, 2017 Kool
Anthony Amolochitis
Even though you don't have the source code, you can edit the php file. The functions are there. Just use your IDE to do a find.
As far as KoolPHP, I've used them for about 9 or 10 years now at multiple companies.
They've done a good job for me. If you did purchase their product, they usually provide support pretty well most of the time in their ticket system.
Just provide them with the complete code segment, and the expected output, and the error messages you are recieving to make the solution to the problem quicker.
Anyways, give editing your code a change too, since it just looks like the function name is not spelled correctly. I believe it is case sensitive.
In my code, the function name was spelled exactly as I input it into the forum. Before I purchased source code, I had fixed some issues that way myself and submitted the fix to them ahead of time in hopes of improving the product.
Take it easy Mark, and enjoy your weekend man.
Posted Apr 1, 2017 Kool
Mark
Thanks Anthony
I put in a ticket, but also bought a different grid. It is working and we are moving on. We will be using the rest of the KoolPHP features, as they are also needed.
If we can get it working, then we will use Kool. When I pay for software, I need it to work. Our deadlines are not as flexible as other companies.
Again thanks for your help and we look forward to using Kool for all the other features they have.
Posted Apr 1, 2017 Kool
David
Hi Mark,
Thanks for your feedback! Regarding PostgreSQL with KoolGrid, from your error message I think there's a problem with create the data source as the message said that it was a non-object. Please check if the data source object ($ds) is null (using isset function) or get its class name (using get_class function). If it is indeed null, please check if your include path is case-sensitive or not.
Looking forward to your feedback! Thanks!
Posted Apr 3, 2017 Kool