Thank you so much for the recommendation. I had been trying with a more recent version of ElkArte, however I'm still having an issue I've been trying to debug. Please let me know if I should start a new thread instead.
I've received this error on both my local development server, and when running on the production server.
protected function testTable()
{
if ($_REQUEST['start'] == 0 && empty($_GET['substep']) && ($_GET['step'] == 1 || $_GET['step'] == 2))
{
$query='
SELECT COUNT(*)
FROM ' . $this->config->from_prefix . $this->config->source->getTableTest();
$result = $this->db->query($query, true);
echo $query;//die();
if ($result === false)
throw new \Exception($this->lng->get(array('permission_denied', $this->db->getLastError(), (string) $this->xml->general->name)));
$this->db->free_result($result);
}
}
It's happening here in test table.
This is the query that is formed. I'm guessing the database name goes in there at ``, but I've never used a SQL connection that isn't associated with a single database. I'm embarrassed to say I didn't know it was possible outside the MYSQL command line
protected function init_db()
{
try
{
list ($db_server, $db_user, $db_passwd, $db_persist, $db_prefix, $db_name) = $this->config->destination->dbConnectionData();
print_r($this->config->destination->dbConnectionData());
$this->db = new Database($db_server, $db_user, $db_passwd, $db_persist);
Further down in init_db is getting the database settings. I dumped them just to check what we're getting.
All of this is correct for my development box.
if (strpos($db_prefix, '.') === false)
{
// @todo ???
if (is_numeric(substr($db_prefix, 0, 1)))
$this->config->to_prefix = $db_name . '.' . $db_prefix;
else
$this->config->to_prefix = '`' . $db_name . '`.' . $db_prefix;
}
else
{
$this->config->to_prefix = $db_prefix;
}
$this->config->from_prefix = $this->config->source->getPrefix();
if (preg_match('~^`[^[icode]]+[/icode].\d~', $this->config->from_prefix) != 0)
{
$this->config->from_prefix = strtr($this->config->from_prefix, array('`' => ''));
}
Further down in init_db() there's some handling of the to/from_prefix. I don't quite get what it does. Let's see what happens if I force the database name.
$query='
SELECT COUNT(*)
FROM dp_forum.users'; //. $this->config->from_prefix . $this->config->source->getTableTest();
Lots of these in a loop.
Getting closer I think. The database name is being wiped out somewhere. I will poke around some more and see if I can just force the correct names for my install and move forward.
Thank you again for getting me started.