mysqli and get_dropdown_values

Questionsmysqli and get_dropdown_values
Richard asked 10 years ago

I get an error when using get_dropdown_values together with mysqli.

$db_conf["type"] = "mysqli";
$db_conf["server"] = "localhost"; // or you mysql ip
$db_conf["user"] = "user"; // username
$db_conf["password"] = "password"; // password
$db_conf["database"] = "dbname"; // database

$str = $g->get_dropdown_values("select team_id as k, team_name as v from t_teams");

"Couldn't execute query. Access denied for user 'apache'@'localhost' (using password: NO) – select team_id as k, team_name as v from t_teams"

Any ideas?

2 Answers
Abu Ghufran answered 10 years ago


This comes when you provide incorrect credentials (user/pass) of mysql database.

Plus one more update, If you are dealing with utf8 characters, you need to replace a line in jqgrid_dist.php.
Updated for next version.

if ($db_conf["type"] == "mysql")
$this->con->Execute("SET NAMES 'utf8'");

if ($db_conf["type"] == "mysql" || $db_conf["type"] == "mysqli")
$this->con->Execute("SET NAMES 'utf8'");

Richard answered 10 years ago

Thanks for the tip re jqgrid_dist.php.

It may help someone else to know that my problem was caused by incorrectly using

$g = new jqgrid();
instead of
$g = new jqgrid($db_conf);

Your Answer

12 + 14 =

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?