Thanks for the plugin. I’ve been using it a long while.
The DB_HOST
constant in wp-config.php
can contain a non-default port. The plugin falls over with this. Here’s how to fix it:
Change:
$this->db = mysqli_connect( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME );
to:
$host = preg_match('/^(\S+):(\d+)$/', DB_HOST, $matches) ? $matches[1] : DB_HOST;
$port = preg_match('/^(\S+):(\d+)$/', DB_HOST, $matches) ? $matches[2] : ini_get('mysqli.default_port');
$this->db = mysqli_connect( $host, DB_USER, DB_PASSWORD, DB_NAME, $port );
]]>
I’ve added this line to the _construct function:
$this->db->set_charset(DB_CHARSET);
and it doe the job now.
——
Also – is it possible to set a variable for the plugin class?
$sql_executioner = new SQL_Executioner_Plugin();
I’m building a plug-in for a client’s site. And need to “hijack” other plugins’ menu pages. Having a variable allows me to this non-destructively. ie. without editing sql-executioner’s code directly.
Thank you
]]>I am trying to use your plugin to write a SQL query that sets a variable using a select count(*) command and then performs an IF/THEN statement using the variable as the comparison (=0, >0)
I keep getting errors and am wondering if your plugin supports this complex a query?
I’m pretty sure I’m using the query syntax correctly because I run the query to assign the variable separately and do get an expected value.
Thanks,
Chris
Message: The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
File: C:\xampp\htdocs\site_url\public_html\store\wp-content\plugins\sql-executioner\sql-executioner.php
Line: 41
]]>Excellent plugin thanks!
Will you do some correct to avoid the “Deprecated: mysql_connect()” warning ?