I ran the index.php. Index.php show a error.
The error is"eprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in X:xampp-win32-5.6.8-0-VC11xampphtdocsphpgriddemoseditingindex.php on line 14"
I tried to change from mysql_connect() to mysqli_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS, PHPGRID_DBNAME);
And i delete the "mysql_select_db(PHPGRID_DBNAME);".
It show "Couldn't execute query. No database selected – SELECT * FROM clients WHERE 1=1 LIMIT 1 OFFSET 0"
How to solve the problem.
Thank you very much.
Hi,
Use this code sample for mysqli connection:
http://phpgrid.org/demo/demos/loading/db-layer-mysqli.phps
Hi Abu Ghufran,
I tried to copy db-layer-mysqli.php to X:xampp-win32-5.6.8-0-VC11xampphtdocsphpgriddemosloading. it still show ": mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO ".
Thank you very much.
mysql_connect is not used anywhere else inside library. May be it's being called by some other code.
If you use db-layer-mysqli.php … it should not show mysql_connect.
Please check file and line number that comes with error.
i change the phpgrid/demos/editing/index.php.
Change mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS); to mysqli_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS, PHPGRID_DBNAME);
The page still show "Couldn't execute query. No database selected – SELECT * FROM clients WHERE 1=1 LIMIT 1 OFFSET 0".
How to solve the problem.
To use mysqli driver,
You need to replace:
mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
mysql_select_db(PHPGRID_DBNAME);
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
$g = new jqgrid();
with:
$db_conf = array();
$db_conf["type"] = "mysqli";
$db_conf["server"] = PHPGRID_DBHOST; // or you mysql ip
$db_conf["user"] = PHPGRID_DBUSER; // username
$db_conf["password"] = PHPGRID_DBPASS; // password
$db_conf["database"] = PHPGRID_DBNAME; // database
// include and create object
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
$g = new jqgrid($db_conf);
We're working on updating all demos and will be done in coming version.
Quick solution is to pass db config array to constructor and remove mysql_ functions:
$db_conf = array();
$db_conf["type"] = "mysqli";
$db_conf["server"] = PHPGRID_DBHOST; // or you mysql ip
$db_conf["user"] = PHPGRID_DBUSER; // username
$db_conf["password"] = PHPGRID_DBPASS; // password
$db_conf["database"] = PHPGRID_DBNAME; // database
$g = new jqgrid($db_conf);
just that i did, and works with C:wampwwwphpgriddemoseditingindex.php, but when i try with other demos; like C:wampwwwphpgriddemosmaster-detailmaster-detail.php, i did the same thing and send not error, just this:"Couldn't execute query. No database selected – SELECT id,client…."
I am unable to generate this issue. I am emailing you updated library, please test after update.
Also if issue persist, send me complete code on my email [email protected]
this still not work, i did what you said, this is the part of code and the path where the file is, please tellme what is wrong!
$db_conf = array();
$db_conf["type"] = "mysqli";
$db_conf["server"] = PHPGRID_DBHOST; // or you mysql ip
$db_conf["user"] = PHPGRID_DBUSER; // username
$db_conf["password"] = PHPGRID_DBPASS; // password
$db_conf["database"] = PHPGRID_DBNAME; // database
// include and create object
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
$grid = new jqgrid($db_conf);
the message error is : Couldn't execute query. No database selected – SELECT id,client_id,invdate,amount,tax,note,total,'' as 'company' FROM invheader WHERE client_id = 0 LIMIT 1 OFFSET 0