Deprecated: mysql_connect():

QuestionsDeprecated: mysql_connect():
Sean Clarke asked 10 years ago

Just installed PHP Grid on a WAMP server.

However we are getting

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:wampwwwphpgriddemoseditingindex.php on line 14

Apache v2.4.9 – PHP v5.5.12 – MySQL v5.6.17

What do we need to do to get this working ?

12 Answers
Abu Ghufran answered 10 years ago

Hello,

You need to change mysql -> mysqli in config.php.
It will take care of rest demos.

Osiris Corona answered 10 years ago

I just changed to mysqli and still not working

Abu Ghufran answered 10 years ago

Refer faq:

Q) How to use mysqli extension?

Here is the config settings.

$db_conf = array();
$db_conf["type"] = "mysqli";
$db_conf["server"] = "localhost"; // or you mysql ip
$db_conf["user"] = "root"; // username
$db_conf["password"] = "test"; // password
$db_conf["database"] = "griddemo"; // database

// include and create object
$base_path = strstr(realpath("."),"demos",true)."lib/";
include($base_path."inc/jqgrid_dist.php");
$g = new jqgrid($db_conf);

After that, all calls will use mysqli extension.

Abu Ghufran answered 10 years ago

For demos,

Comment these lines in index.php
// // set up DB
// mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
// mysql_select_db(PHPGRID_DBNAME);

In config.php

// Automatically make db connection inside lib, without pass $dbconf — set 1
define("PHPGRID_AUTOCONNECT",1);

// set mysqli
define("PHPGRID_DBTYPE","Mysqli");

These changes should run the demo.

jens ubert answered 10 years ago

Hi, we have an older Version of PHPGrid with this construction

define('DB_HOSTNAME','localhost'); // database host name
define('DB_USERNAME', 'root'); // database user name
define('DB_PASSWORD', 'lamop780'); // database password
define('DB_NAME', 'aggregated'); // database name
define('DB_TYPE', 'mysqli'); // database type
define('DB_CHARSET','utf8'); // ex: utf8(for mysql),AL32UTF8 (for oracle), leave blank to use the default charset

in conf.php

We cannot connct it to mysqli. What to do?

Abu Ghufran answered 10 years ago

We do not have any such configuration, our product documentation is on this url.

Docs

Abu Ghufran answered 10 years ago

Our product don't support this api and constant since v1.
Perhaps, you are searching for similar product from http://www.phpgrid.com vendor.

jens ubert answered 10 years ago

Hi, we have an older Version of PHPGrid with this construction

define('DB_HOSTNAME','localhost'); // database host name
define('DB_USERNAME', 'root'); // database user name
define('DB_PASSWORD', 'lamop780'); // database password
define('DB_NAME', 'aggregated'); // database name
define('DB_TYPE', 'mysqli'); // database type
define('DB_CHARSET','utf8'); // ex: utf8(for mysql),AL32UTF8 (for oracle), leave blank to use the default charset

in conf.php

We cannot connct it to mysqli. What to do?

Abu Ghufran answered 10 years ago

The demo browser is based mysql_connect functions. So it may not run with PHP 5.6+
W're working on updating demo browser to remove the deprecated functions.

Library do support mysqli and working demo can be checked from this link:

Code: http://phpgrid.org/demo/demos/loading/db-layer-mysqli.phps
Live: http://phpgrid.org/demo/demos/loading/db-layer-mysqli.php

Pedro Queluz answered 10 years ago

I'm having trouble making the connection with the Bank of oracle data, could send me an example of connection?

Peter Ramer answered 9 years ago

The last comment helped me. Though just to be specific, the index.php Abu is referring to is the one found here: phpgriddemosediting It is not the index.php found in the root phpgrid folder

Peter Ramer answered 9 years ago

Actually, while I no longer receive the error when I browse to index.php I do receive errors when I click on any of the links because it seems many of them have calls to mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
mysql_select_db(PHPGRID_DBNAME);

And commenting out these lines cause the demo to not show anything. So this did not fix my problem.

Your Answer

10 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?