Link to home
Start Free TrialLog in
Avatar of Ryan Rood
Ryan RoodFlag for Canada

asked on

MySQL Database not found

Hello,
We have recently upgraded to php 7.4 for our intranet on windows 10 and we are getting a database not found error. All the files for the database are there and should be in working order. Everything worked fine on 7.3 with Windows 7.The log files do not give any hints as to why the database isn't being found. Does anyone know of anything that would have changed between versions?

Thanks
Avatar of Robert Granlund
Robert Granlund
Flag of United States of America image

Please check the name of the database and password.  Then make sure the connection script is correct.  You can also post the connection script sans username / password
Avatar of arnold
You have to check whether the pop 7.4 incorporates the support for SQL access or whether you need to locate some dlls on which it telies.

Double check whether you specified the db name correctly.

Check release notes and see whether they impact the SQL version in use.

My question often in such a case, why did you go to 7.4 ?

Usually version transitions should be carefully planned out to allow testing.
The log files do not give any hints as to why the database isn't being found

if it's really hard for the debugging in existing codes, why not create a custom php page to test the database connection to drill down the issues?
Part of the php connection process should point to where the issue is.
Avatar of Ryan Rood

ASKER

I don't think the original post was not detailed enough so let me try again. We are moving from a previous version of Wamp that is many years old. Moving to Windows 10 with the current version of Wamp. I will post specific versions below. Originally this was setup under contract with a private developer. This developer is no longer available. From what I can see and tell (not a software/web person) it looks like some of the functions being called for are deprecated and that is probably causing some of the issues. In most cases for the errors replacing MySQL with MySQLi fixes the errors other than the database connection itself it seems. There are technically two different machines with identical symptoms.

Old:
WAMP Server 2.2
Apache 2.2.2
PHP 5.3.13
MySQL 5.5.24

New:
WAMP Server 3.2
Apache 2.4.1
PHP 7.3.12
MySQL 5.7.28

Appreciate the input, thank you.
MySQL.pdf
users.png
Annotation-2020-02-15-070838.png

Here is the current error I am seeing.

User generated image

the user you are using, exist as @localhost and @% anywhere, do they have the same password?
Are you using the password for @localhost?

Best, add a specific newuser with rights to DB and try it.
Grant the newuser select, insert, update,delete,.. on this database and see..

Possibly the DB auth..

I reset both passwords just to confirm. No change. I added a new user. No change. How would you go about testing the DB auth?

do you have MySQL workbench installed?
Login using one of the users.

Reset, did you reset them to the same password.
Are you connecting tothe local?
Is the local configured to run over TCP?

Netstat -an | find /I ":3306" is it bound to localhost or any?
Use workbench to login as the same user you are using within the php.

Are you using the same code from the php5 in php7 setup?
do you test whether $connection is defined when passing it? If you iss and pass as undefined variable.

C:\>netstat -an | find /I ":3306"
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING
  TCP    [::]:3306              [::]:0                 LISTENING


I have tried localhost and the ipv4 address. I do not have workbench installed. I will work on that. Same code for php5 as in php7. I switched wamp to php5 and the same error occurs.


" do you test whether $connection is defined when passing it? If you iss and pass as undefined variable."

*** I don't know how to do this.


Both users were reset to the same password.

You would test if exists $connection

What you posted, PDF is mysqli function from php ?

Your mhp has includes? Do you load/reference the connections.xml file?

Using Work Bench it didn't look like the user existed. I added the user and now I am getting a new error. I also included the connections.php and kernel.php file.


User generated image


<?php
/* Version 1.0.1 - 10:16 PM 26/07/2009 */
/* 1.0.1 - Added SQL class */

session_start();
header("Cache-control: private");

error_reporting(E_ALL);

require_once("base/vrk_classes/VRKMessage.php");
require_once("base/vrk_classes/Connections.php");
require_once("base/vrk_classes/SQLMaps.php");
require_once("base/vrk_classes/Parser.php");
require_once("base/vrk_classes/Validator.php");
require_once("base/vrk_classes/JSCompiler.php");
require_once("base/vrk_classes/Datasource.php");
require_once("base/vrk_classes/LoopStack.php");
require_once("base/vrk_classes/SQL.php");

require_once("base/vrk_modules/Display.php");
require_once("base/vrk_modules/MySQL.php");

require_once("base/modules/Array.php");
require_once("base/modules/String.php");

require_once("base/vrk_abstracts/ExtTag.php");

require_once("base/functions.php");

global $vrk_jsc
	, $vrk_connections
	, $vrk_sql_maps
	, $vrk_parser
	, $vrk_validator
	, $vrk_message;

$vrk_jsc = new JSCompiler();
$vrk_connections = new Connections();
$vrk_sql_maps = new SQLMaps();
$vrk_parser = new Parser();
$vrk_validator = new Validator();
$vrk_message = new VRKMessage();

if (file_exists("config/loader.php")) require_once("config/loader.php");
include_once("config/connections.php");
?>

Open in new window


<?php
/* Version 1.0.0 - 8:54 PM 05/07/2009 */

get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);

for ($i = 0; $i < count($connection_data); $i++)
{
	if ($connection_data[$i]["tag"] == "connection" && $connection_data[$i]["type"] == "open")
	{
		$vrk_connections->create_connection($connection_data[$i]["attributes"]["name"]);
	}
	else if ($connection_data[$i]["tag"] != "connections" && $connection_data[$i]["type"] == "complete")
	{
		$vrk_connections->add_connection_tag($connection_data[$i]["tag"], $connection_data[$i]["value"]);
	}
}
?>

Open in new window

Final update for the evening - only getting a single error now after reading the error on the following line: 


if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"]))


Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.

User generated image


User generated image


Am I missing anything else?

Change the connection to localhost or 127.0.0.1

The user does not have rights to connect .......based on your user list, you on,y gave localhost based users.

Tried to change the host to localhost or 127.0.0.1 but it fails. Getting access denied still. Tried to change the user to any host and the same error occurs. 

are you on the same system as the mysql server, or are you connecting remotely?

What is the platform/package of the PHP code?
The code is from 2009.

Is this your proprietary code, or you are using a package and see whether there is a newer version.

To determine what is going on,
The Db selection has to be passed the $connection  that is established to the server.

Yes - same computer.


Custom code that we paid a private developer to do. 2009 sounds about right.


It is proprietary. 


I am not sure how to do this. Does EE still allow to hire experts? I can provide the full code and a blank database. The Wamp installation is a basic install with nothing additional. We do use AD authentication but I am sure that could be bypassed to test. 

at the end of your mysql.php (the MySQL.pdf)
The mysqli_select_db has changed, flip the two
Your current has mysqli_select_db("databasename",connection_to_database_server)

While the new mysqli_select_db uses the following scheme
mysqli_select_db(connection_to_database_server,"databasename")

This should fix the issue confirming a database can be selected.
Change the following

if (!mysqli_select_db($connection["dbname"], $vrk_connections->cur_db)) {
 die("Error selecting database '".$connection["dbname"]."' on connection
 '".$connection_name."'. Ensure you have the correct database name.");
  }

Open in new window


 With

 
if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"],)){
 die("Error selecting database '".$connection["dbname"]."' on connection
 '".$connection_name."'. Ensure you have the correct database name.");
  }

Open in new window


 This is at the bottom of you MySQL.pdf document.

Lines 196-199

Still getting the error. Attached new MySQL file with revised code and error.User generated image

<?php
/* Version 1.0.0 - 1:12 PM 25/07/2009 */

function mysqli_truncate_table($connection, $table)
{
	mysqli_initialize($connection);
	mysqli_query("TRUNCATE TABLE ".mysqli_real_escape_string($table));
}

function mysqli_count_rows($connection, $table, $condition = "1=1")
{
	mysqli_initialize($connection);
	$res = mysqli_query("SELECT * from ".mysqli_real_escape_string($table)." WHERE $condition");
	if ($res) return mysqli_num_rows($res);
	else return 0;
}

function mysqli_optimize($connection, $table)
{
	mysqli_initialize($connection);
	return mysqli_query("OPTIMIZE TABLE ".mysqli_real_escape_string($table));
}

function mysqli_delete_row($connection, $table, $condition)
{
	mysqli_initialize($connection);

	$result = mysqli_query("DELETE from ".mysqli_real_escape_string($table)." WHERE $condition");
	return $result;
}

function mysqli_update_row($connection, $table, $values, $condition)
{
	mysqli_initialize($connection);

	$i = 0;
	$update_values = "";
	foreach ($values as $key => $value)
	{
		($i != 0) ? $update_values.="," : $i = 1;
		if (strtolower(substr($value, 0, 4)) == "sql:") $update_values.= "`".mysqli_real_escape_string($key)."`=".mysqli_real_escape_string(substr($value, 4));
		else $update_values.= "`".mysqli_real_escape_string($key)."`='".mysqli_real_escape_string($value)."'";
	}

	if (mysqli_query("UPDATE ".mysqli_real_escape_string($table)." SET $update_values WHERE $condition")) return true;
	else 
	{
		echo mysqli_error();
		return false;
	}
}

function mysqli_insert_row($connection, $table, $values)
{
	mysqli_initialize($connection);

	if (isset($values[0]))
	{
		$insert_values = "'".$values[0]."'";
		for ($i = 1; $i < count($values); $i++)
		{
			if (strtolower(substr($values[$i], 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($values[$i], 4));
			else $insert_values.= ",'".mysqli_real_escape_string($values[$i])."'";
		}
		$query = "INSERT INTO ".mysqli_real_escape_string($table)." VALUES ($insert_values)";
	}
	else
	{
		$table_cols = "";
		$insert_values = "";
		foreach ($values as $key => $value)
		{
			$table_cols.= ",`".mysqli_real_escape_string($key)."`";
			if (strtolower(substr($value, 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($value, 4));
			else $insert_values.= ",'".mysqli_real_escape_string($value)."'";
		}
		// remove extra comma
		$table_cols = substr($table_cols, 1);
		$insert_values = substr($insert_values, 1);
		$query = "INSERT INTO ".mysqli_real_escape_string($table)." ($table_cols) VALUES ($insert_values)";
	}

	if (mysqli_query($query)) return true;
	else 
	{
		echo mysqli_error();
		return false;
	}
}

function mysqli_does_row_exist($connection, $table, $condition)
{
	mysqli_initialize($connection);

	$result = mysqli_query("SELECT * FROM ".mysqli_clean($connection, $table)." WHERE $condition");
	if ($result) return ($row = mysqli_fetch_assoc($result));
	return false;
}

function mysqli_get_field_query($connection, $field, $table, $condition = "", $offset = "")
{
	mysqli_initialize($connection);

	if ($condition != "") $condition = " WHERE $condition";
	if ($offset != "") $order = " OFFSET $offset";

	$result = mysqli_query("SELECT `$field` FROM `".mysqli_real_escape_string($table)."`$condition LIMIT 1$offset");
	if ($result) 
	{
		$row = mysqli_fetch_assoc($result);
		return $row[$field];
	}
	return "";
}

function mysqli_clean($connection, $val)
{
	mysqli_initialize($connection);
	return mysqli_real_escape_string($val);
}

function mysqli_single_row_query($connection, $sql_query, $offset = "")
{
	mysqli_initialize($connection);

	if ($offset != "") $order = " OFFSET $offset";
	
	$result = mysqli_query($sql_query." LIMIT 1$offset");
	if ($result) return mysqli_fetch_assoc($result);
	return "";
}

function mysqli_multi_row_query($connection, $sql_query, $order = "", $limit = "", $offset = "")
{
	mysqli_initialize($connection);

	if (isset($_GET["vrksort"]) && $_GET["vrksort"] != "")
	{
		if (substr($_GET["vrksort"], 0, 2) == "d:") $order = " ORDER BY ".substr($_GET["vrksort"], 2)." DESC";
		else $order = " ORDER BY ".$_GET["vrksort"];
	}
	else if ($order != "") $order = " ORDER BY $order";

	if (isset($_GET["vrklimit"]) && $_GET["vrklimit"] != "") $limit = " LIMIT ".$_GET["vrklimit"];
	else if ($limit != "") $limit = " LIMIT $limit";
	
	if (isset($_GET["vrkoffset"]) && $_GET["vrkoffset"] != "") $offset = " OFFSET ".$_GET["vrkoffset"];
	else if ($offset != "") $offset = " OFFSET $offset";

	$result = mysqli_query($sql_query.$order.$limit.$offset);

	$res_array = array();
	if ($result) while ($row = mysqli_fetch_assoc($result)) $res_array[count($res_array)] = $row;
	else echo mysqli_error();
	if (!isset($res_array)) return "";
	else return $res_array;
}

function mysqli_last_id()
{
	return mysqli_insert_id();
}

function mysqli_found_rows()
{
	$result = mysqli_query("SELECT FOUND_ROWS()");
	if ($result)
	{
		$row = mysqli_fetch_assoc($result);
	}
	else
	{
		echo mysqli_error();
	}
	
	if (!isset($row))
	{
		return 0;
	}
	else
	{
		return $row["FOUND_ROWS()"];
	}
}

function mysqli_initialize($connection_name)
{
	global $vrk_connections;
	$connection = $vrk_connections->get_connection($connection_name);
	$vrk_connections->cur_db = mysqli_connect($connection["dbhost"],
	$connection["dbuser"], $connection["dbpassword"]);
	if (!$vrk_connections->cur_db)
	{
		die("Unable to connect to host. Ensure you have the correct connection information.");
	}

	/* if (!mysqli_select_db($connection["dbname"], $vrk_connections->cur_db))
	{
		die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
	} */
	if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"],))
	{
		die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
	}
}
?>

Open in new window

Now, you can connect, this error deals whether your connection is still present.

The issue is that at sone point, you gave the mysqli_initialize called and the connection to the DB is not present.

See line194

I do not see a point of defining $connection=$vrk....
But then continue using $vrk....

The code. Is for php 5 while you are now on php 7

ypu possibly need to add an else to the connection being missing, to reinitialize it by effectively closing $vrk_connections->cur_db


In the initialize section it defines a connection, but the connection dies without being reinitialized

If only I knew how to code PHP (lol). Any way you can re-write the code for me to what it should be?

Look at the top of the image you posted, it reports that it is trying to access as a username@localhost versus the xml file where you had it connecting to 192.168.x.x IP
which would have made the error as username@192.168.x.x...

Scan the file to see whether you have other connections.xml files.
the parametrer get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);

have to think through how to adjust the lines 189-194 that deal with test whether a connection is present, and establish if not present,
all your info seems to be isolated to the Connections.php and the Mysql.php file since you call mysqli_initialize and the function does not check whether the connection is present. the peculiar thing there is that it assigns a local place holder, $connection, but then seems to not use it.


The other issue you may have is that the connections keep getting setup such that it reaches a point where no more connections can be made.
as they might not be properly closed.
Check the log on the mysql server to see whether it is reporting an error that number of sessions/connection being exceeded.

Changed the connection back to the IP Address. No errors other than the database error now. No errors in MySQL. PHP was logging this but is now gone with the change:


[16-Feb-2020 18:25:25 UTC] PHP Warning:  mysqli_connect(): (HY000/1045): Access denied for user 'installedsales'@'localhost' (using password: YES) in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 191 
[16-Feb-2020 18:25:25 UTC] PHP Stack trace: 
[16-Feb-2020 18:25:25 UTC] PHP   1. {main}() C:\wamp\www\main.php:0 
[16-Feb-2020 18:25:25 UTC] PHP   2. product_type_get_all() C:\wamp\www\main.php:45 
[16-Feb-2020 18:25:25 UTC] PHP   3. mysqli_multi_row_query() C:\wamp\www\vrk\modules\Jobs.php:16 
[16-Feb-2020 18:25:25 UTC] PHP   4. mysqli_initialize() C:\wamp\www\vrk\base\vrk_modules\MySQL.php:135 
[16-Feb-2020 18:25:25 UTC] PHP   5. mysqli_connect() C:\wamp\www\vrk\base\vrk_modules\MySQL.php:191

Open in new window


There is only one reference to connections.xml. There are two connection.php files in different folders:

<?php
/* Version 1.0.0 - 8:54 PM 05/07/2009 */

get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);

for ($i = 0; $i < count($connection_data); $i++)
{
	if ($connection_data[$i]["tag"] == "connection" && $connection_data[$i]["type"] == "open")
	{
		$vrk_connections->create_connection($connection_data[$i]["attributes"]["name"]);
	}
	else if ($connection_data[$i]["tag"] != "connections" && $connection_data[$i]["type"] == "complete")
	{
		$vrk_connections->add_connection_tag($connection_data[$i]["tag"], $connection_data[$i]["value"]);
	}
}
?>

Open in new window

<?php
/* Version 1.0.1 - 8:55 PM 05/07/2009 */
/* 1.0.1 - remove cur_db variable as it is no longer needed */

class Connections
{
	var $connections;
	var $_last_connection;
	
	function __construct()
	{
		$connections = array();
	}

	function get_connection($name)
	{
		return $this->connections[$name];
	}

	function create_connection($name)
	{
		$this->connections[$name] = array();
		$this->_last_connection = &$this->connections[$name];
	}

	function add_connection_tag($tag, $value)
	{
		$this->_last_connection[$tag] = $value;
	}
}
?>

Open in new window

When I ask a question, it is for the purpose to work things out, it is not a suggestion to make a change.
If your connections.xml has 192.168.0.225 leave it as is.
The error you are getting might be from a different page you accessed.

Please attach the MySQL.php and the Connections.php

I apologize - I meant to set it back and didn't.


// connections.php - in the same directory as connections.xml
<?php
/* Version 1.0.0 - 8:54 PM 05/07/2009 */

get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);

for ($i = 0; $i < count($connection_data); $i++)
{
	if ($connection_data[$i]["tag"] == "connection" && $connection_data[$i]["type"] == "open")
	{
		$vrk_connections->create_connection($connection_data[$i]["attributes"]["name"]);
	}
	else if ($connection_data[$i]["tag"] != "connections" && $connection_data[$i]["type"] == "complete")
	{
		$vrk_connections->add_connection_tag($connection_data[$i]["tag"], $connection_data[$i]["value"]);
	}
}
?>

Open in new window

// MySQL.php
<?php
/* Version 1.0.0 - 1:12 PM 25/07/2009 */

function mysqli_truncate_table($connection, $table)
{
	mysqli_initialize($connection);
	mysqli_query("TRUNCATE TABLE ".mysqli_real_escape_string($table));
}

function mysqli_count_rows($connection, $table, $condition = "1=1")
{
	mysqli_initialize($connection);
	$res = mysqli_query("SELECT * from ".mysqli_real_escape_string($table)." WHERE $condition");
	if ($res) return mysqli_num_rows($res);
	else return 0;
}

function mysqli_optimize($connection, $table)
{
	mysqli_initialize($connection);
	return mysqli_query("OPTIMIZE TABLE ".mysqli_real_escape_string($table));
}

function mysqli_delete_row($connection, $table, $condition)
{
	mysqli_initialize($connection);

	$result = mysqli_query("DELETE from ".mysqli_real_escape_string($table)." WHERE $condition");
	return $result;
}

function mysqli_update_row($connection, $table, $values, $condition)
{
	mysqli_initialize($connection);

	$i = 0;
	$update_values = "";
	foreach ($values as $key => $value)
	{
		($i != 0) ? $update_values.="," : $i = 1;
		if (strtolower(substr($value, 0, 4)) == "sql:") $update_values.= "`".mysqli_real_escape_string($key)."`=".mysqli_real_escape_string(substr($value, 4));
		else $update_values.= "`".mysqli_real_escape_string($key)."`='".mysqli_real_escape_string($value)."'";
	}

	if (mysqli_query("UPDATE ".mysqli_real_escape_string($table)." SET $update_values WHERE $condition")) return true;
	else 
	{
		echo mysqli_error();
		return false;
	}
}

function mysqli_insert_row($connection, $table, $values)
{
	mysqli_initialize($connection);

	if (isset($values[0]))
	{
		$insert_values = "'".$values[0]."'";
		for ($i = 1; $i < count($values); $i++)
		{
			if (strtolower(substr($values[$i], 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($values[$i], 4));
			else $insert_values.= ",'".mysqli_real_escape_string($values[$i])."'";
		}
		$query = "INSERT INTO ".mysqli_real_escape_string($table)." VALUES ($insert_values)";
	}
	else
	{
		$table_cols = "";
		$insert_values = "";
		foreach ($values as $key => $value)
		{
			$table_cols.= ",`".mysqli_real_escape_string($key)."`";
			if (strtolower(substr($value, 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($value, 4));
			else $insert_values.= ",'".mysqli_real_escape_string($value)."'";
		}
		// remove extra comma
		$table_cols = substr($table_cols, 1);
		$insert_values = substr($insert_values, 1);
		$query = "INSERT INTO ".mysqli_real_escape_string($table)." ($table_cols) VALUES ($insert_values)";
	}

	if (mysqli_query($query)) return true;
	else 
	{
		echo mysqli_error();
		return false;
	}
}

function mysqli_does_row_exist($connection, $table, $condition)
{
	mysqli_initialize($connection);

	$result = mysqli_query("SELECT * FROM ".mysqli_clean($connection, $table)." WHERE $condition");
	if ($result) return ($row = mysqli_fetch_assoc($result));
	return false;
}

function mysqli_get_field_query($connection, $field, $table, $condition = "", $offset = "")
{
	mysqli_initialize($connection);

	if ($condition != "") $condition = " WHERE $condition";
	if ($offset != "") $order = " OFFSET $offset";

	$result = mysqli_query("SELECT `$field` FROM `".mysqli_real_escape_string($table)."`$condition LIMIT 1$offset");
	if ($result) 
	{
		$row = mysqli_fetch_assoc($result);
		return $row[$field];
	}
	return "";
}

function mysqli_clean($connection, $val)
{
	mysqli_initialize($connection);
	return mysqli_real_escape_string($val);
}

function mysqli_single_row_query($connection, $sql_query, $offset = "")
{
	mysqli_initialize($connection);

	if ($offset != "") $order = " OFFSET $offset";
	
	$result = mysqli_query($sql_query." LIMIT 1$offset");
	if ($result) return mysqli_fetch_assoc($result);
	return "";
}

function mysqli_multi_row_query($connection, $sql_query, $order = "", $limit = "", $offset = "")
{
	mysqli_initialize($connection);

	if (isset($_GET["vrksort"]) && $_GET["vrksort"] != "")
	{
		if (substr($_GET["vrksort"], 0, 2) == "d:") $order = " ORDER BY ".substr($_GET["vrksort"], 2)." DESC";
		else $order = " ORDER BY ".$_GET["vrksort"];
	}
	else if ($order != "") $order = " ORDER BY $order";

	if (isset($_GET["vrklimit"]) && $_GET["vrklimit"] != "") $limit = " LIMIT ".$_GET["vrklimit"];
	else if ($limit != "") $limit = " LIMIT $limit";
	
	if (isset($_GET["vrkoffset"]) && $_GET["vrkoffset"] != "") $offset = " OFFSET ".$_GET["vrkoffset"];
	else if ($offset != "") $offset = " OFFSET $offset";

	$result = mysqli_query($sql_query.$order.$limit.$offset);

	$res_array = array();
	if ($result) while ($row = mysqli_fetch_assoc($result)) $res_array[count($res_array)] = $row;
	else echo mysqli_error();
	if (!isset($res_array)) return "";
	else return $res_array;
}

function mysqli_last_id()
{
	return mysqli_insert_id();
}

function mysqli_found_rows()
{
	$result = mysqli_query("SELECT FOUND_ROWS()");
	if ($result)
	{
		$row = mysqli_fetch_assoc($result);
	}
	else
	{
		echo mysqli_error();
	}
	
	if (!isset($row))
	{
		return 0;
	}
	else
	{
		return $row["FOUND_ROWS()"];
	}
}

function mysqli_initialize($connection_name)
{
	global $vrk_connections;
	$connection = $vrk_connections->get_connection($connection_name);
	$vrk_connections->cur_db = mysqli_connect($connection["dbhost"],
	$connection["dbuser"], $connection["dbpassword"]);
	if (!$vrk_connections->cur_db)
	{
		die("Unable to connect to host. Ensure you have the correct connection information.");
	}

	/* if (!mysqli_select_db($connection["dbname"], $vrk_connections->cur_db))
	{
		die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
	} */
	if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"],))
	{
		die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
	}
}
?>

Open in new window

// Connections.php
<?php
/* Version 1.0.1 - 8:55 PM 05/07/2009 */
/* 1.0.1 - remove cur_db variable as it is no longer needed */

class Connections
{
	var $connections;
	var $_last_connection;
	
	function __construct()
	{
		$connections = array();
	}

	function get_connection($name)
	{
		return $this->connections[$name];
	}

	function create_connection($name)
	{
		$this->connections[$name] = array();
		$this->_last_connection = &$this->connections[$name];
	}

	function add_connection_tag($tag, $value)
	{
		$this->_last_connection[$tag] = $value;
	}
}
?>

Open in new window

// connections.xml
<connections>
	<connection name="installed_sales">
		<dbname>copps_installed_sales</dbname>
		<dbuser>installedsales</dbuser>
		<dbpassword>sanitized</dbpassword>
		<dbhost>192.168.0.225</dbhost>
	</connection>
</connections>

Open in new window


Backup your existing MySQL.php and replace with the one attached.

The difference on line 190 test whether a connection is already present before starting to establish a new connection. The second test is if the connection is not present, whether the establishing of the connection succeeded.

See if it makes a difference that you currently experience establish a connection and then select the DB.

Does this tool connect to other databases on the same mysql server?
question deals with mysqli_connect includes an option to specify the DB to attach deals with a situation where the dbuser, dbpasswd and dbname must be present
This will render the mysqli_select_db useless, unneeded.
MySQL.php

Only one database on the server. Here is the error message returned after changing the MySQL.php page.User generated image

OK, slight change,

check whether $vrk_connections is defined.
MySQL.php

Updated.User generated image

lets go back to the MySQL.php that the only modified sata was between lines 200-205.

While leave the connections.xml pointing to 192.168.0.225
Note, the example of users from phpmyadmin, the user reflects connection from localhost.

It makes no sense how it is permitted to connect.
Try the following:
Using https://www.php.net/manual/en/function.is-resource.php adn the related get_resource_type to check whether a connection is already in place before making a new connection attempt.

Currently, the code you have seemingly never closed the connection until the php processing exited out.
Usually, instead of calling mysqli_initialize, one would have had a global mysql connection, and would test it. But in this implementation, the mysqli_* related builtin functions, do not explicitly use a connection allowing for the php session..

with that said, the change is minimal in the mysqli_initialize, before making a connection attempt, added the above referenced test to see whether a connection is already in place which would mean there is no need to go through the connection establishment process.
MySQL.php

More errors.

error3.pdf

This is with the new mysql.php or with the original that only had the last four lines changed dealing with the mysqli_select_db?
MySQL---modified.php

I updated the MySQL.php file with the "MySQL---modified.php" and now I am getting:



( ! ) Parse error: syntax error, unexpected '}', expecting end of file in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 206


If I remove the last } it returns to this:



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined variable: vrk_connections in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202
10.0001393656{main}( )...\login.php:0
20.0002393912require_once( 'C:\wamp\www\vrk\Kernel.php' )...\login.php:2
30.0024401456require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' )...\Kernel.php:21

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Trying to get property 'cur_db' of non-object in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202
10.0001393656{main}( )...\login.php:0
20.0002393912require_once( 'C:\wamp\www\vrk\Kernel.php' )...\login.php:2
30.0024401456require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' )...\Kernel.php:21

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined variable: connection in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202
10.0001393656{main}( )...\login.php:0
20.0002393912require_once( 'C:\wamp\www\vrk\Kernel.php' )...\login.php:2
30.0024401456require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' )...\Kernel.php:21

#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_select_db() expects parameter 1 to be mysqli, null given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202
10.0001393656{main}( )...\login.php:0
20.0002393912require_once( 'C:\wamp\www\vrk\Kernel.php' )...\login.php:2
30.0024401456require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' )...\Kernel.php:21
40.0096402088mysqli_select_db ( )...\MySQL.php:202

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined variable: connection in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 204
10.0001393656{main}( )...\login.php:0
20.0002393912require_once( 'C:\wamp\www\vrk\Kernel.php' )...\login.php:2
30.0024401456require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' )...\Kernel.php:21

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined variable: connection_name in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 204
10.0001393656{main}( )...\login.php:0
20.0002393912require_once( 'C:\wamp\www\vrk\Kernel.php' )...\login.php:2
30.0024401456require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' )...\Kernel.php:21
Error selecting database '' on connection ''. Ensure you have the correct database name.


There was a typo see the modified last updated, there was an extra comma (,) that did not belong in the mysqli_select_db, while switching the connection, database name, the extra comma was copied/remained.
See what you get with the mysql.php modified ..

Attaching a Mysql using the same thing that verifies whether the connection is present, and type.
that should avoid the current error.
It tests whether the cur_db is a resources, and if it is it checks whether it is a mysql link. If the answer to both is true, it does nothing meaning, the connection is already present. else it establishes the connection.
MySQL.php

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined property: Connections::$cur_db in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 190
10.0002391432{main}( )...\main.php:0
20.0008417936product_type_get_all( )...\main.php:45
30.0008417936mysqli_multi_row_query( )...\Jobs.php:16
40.0008417936mysqli_initialize( )...\MySQL.php:136
Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.


Lets try the with the modified which is presumably what you have here.
changing the mysqli_select_db to use the same as your other queries without specifying a connection.

try the modified as the MySQL.php first to see what you get.
MySQL---modified.php
Here is the mysql with the check, the connect to the DB uses the local $connection which would not be populated when the connection is present.
MySQL.php

Using the MySQL---modified I get this:

  ( ! ) Parse error: syntax error, unexpected '}', expecting end of file in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 206  

Open in new window


Using MySQL.php I get this:

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined property: Connections::$cur_db in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 190
10.0005391304{main}( )...\main.php:0
20.0048418768product_type_get_all( )...\main.php:45
30.0048418768mysqli_multi_row_query( )...\Jobs.php:16
40.0048418768mysqli_initialize( )...\MySQL.php:136

#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 207
10.0005391304{main}( )...\main.php:0
20.0048418768product_type_get_all( )...\main.php:45
30.0048418768mysqli_multi_row_query( )...\Jobs.php:16
40.0048418768mysqli_initialize( )...\MySQL.php:136
50.0085465664mysqli_select_db ( )...\MySQL.php:207
Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.


The extra one is on line 196, from the connection test scheme.  adjusted and attached.
MySQL---modified.php

File updated:

#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202
10.0002391304{main}( )...\main.php:0
20.0010417808product_type_get_all( )...\main.php:45
30.0010417808mysqli_multi_row_query( )...\Jobs.php:16
40.0010417808mysqli_initialize( )...\MySQL.php:136
50.0017464168mysqli_select_db ( )...\MySQL.php:202
Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.


Are you on php 7?

Adjusted both to once again include the connection in the mysqli_select_db.
MySQL---modified.php
MySQL.php

Yes to php7 - i have tried version version 5.6 as well previously (not since I opened this question).


MySQL---modified.php

  Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.  

Open in new window


MySQL.php

#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined property: Connections::$cur_db in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 190
10.0002391304{main}( )...\main.php:0
20.0036418768product_type_get_all( )...\main.php:45
30.0036418768mysqli_multi_row_query( )...\Jobs.php:16
40.0036418768mysqli_initialize( )...\MySQL.php:136
Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.


Is this on the first pass, or subsequent links?

cur_db is the reference defined globally

You are using the "modified" not the one that does tests for pre-existing connection?

In your main.pho, do not need to see, fo you gave global $vrk_connections ?

I tried both files above ... currently it is the "MySQL.php" file. The error is from loading main.php which loads after active directory is authenticated.


<?php
require_once("vrk/Kernel.php");

if (account_is_logged_in())
{
	// everyone has access to these options
	$applications = array(array("application_url" => "new_install.php?type=install", "application_name" => "New Install Quote Request")
						, array("application_url" => "new_install.php?type=material", "application_name" => "New Material Only Quote Request"));

	$show_jobs = "none";
	
	if (!account_is_in_users_group() || count(account_get_product_types()) > 0)
	{
		$show_jobs = "table-cell";
		$applications[] = array("application_url" => "job_search.php", "application_name" => "Job Search");
	}
	
	// add job type links, if not admin
	if (!account_is_admin())
	{
		$has_prod_type = false;
		foreach (account_get_product_types() as $product_type)
		{
			if (strpos($product_type, "Manage Staff") === false)
			{
				$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type, "application_name" => $product_type." Jobs");
				
				if (!product_type_exists($product_type))
				{
					// create product type
					product_type_create($product_type);
				}
			}
			$has_prod_type = true;
		}
		
		if ($has_prod_type)
		{
			$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
		}
	}
	else
	{
		// admins have access to all job types, get all job types and then add the menus
		foreach (product_type_get_all() as $product_type)
		{
			$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type["product_type"], "application_name" => $product_type["product_type"]." Jobs");
		}
		$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
	}
	
	if (account_manage_staff())
	{
		$applications[] = array("application_url" => "manage_staff.php", "application_name" => "Manage Staff");
	}
	
	// if admin add admin menu options
	if (account_is_admin())
	{
		$applications[] = array("application_url" => "admin_sub_menu.php", "application_name" => "Administrator");
		$applications[] = array("application_url" => "settings.php", "application_name" => "Settings");
	}
	
	$user = account_get_logged_in_name();
	$jobs = get_calendar_jobs(account_get_product_types());
	$out_jobs = array();
	
	foreach ($jobs as $job)
	{
		if (count($out_jobs) > 0 && $out_jobs[count($out_jobs) - 1]["work_date"] == $job["work_date"])
		{
			$out_jobs[count($out_jobs) - 1]["details"].= "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
															Customer: ".$job["customer_name"]."<br />
															Product Type: ".$job["product_type"]."<br /><br />";
		}
		else
		{
			$out_jobs[]["work_date"] = $job["work_date"];
			$out_jobs[count($out_jobs) - 1]["details"] = "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
									Customer: ".$job["customer_name"]."<br />
									Product Type: ".$job["product_type"]."<br /><br />";
		}
	}
	
	display_html("xmls/main.xml", "xmls/template.xml");
}
else
{
	header("Location: index.php");
}
?>

Open in new window

I saw from errors, that main.php calls others that then trigger the mysqli_initialize ...

The connection,$vrk_connections->cur_db passes the test.following mysqli_connect

The error is triggered

One option if you are ok with trying ISO use mysqli_connect with four parameters including the dbname elinating the test for the mysqli_select_db

I am fine with this ... 

Here is the change that deals with settig vrk_connections->cur_db to go directly to the DB as part of the connection string in mysqli_connect.
MySQL---modified.php

I can see some of the webpage now!!! But here is the new errors. It looks like localhost and the IP are returning the same errors.



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: 192.168.0.225 in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 191
10.0004142312{main}(  )...\main.php:0
20.0169872992product_type_get_all(  )...\main.php:45
30.0169873160mysqli_multi_row_query(  )...\Jobs.php:16
40.0169873344mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: installedsales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192
10.0004142312{main}(  )...\main.php:0
20.0169872992product_type_get_all(  )...\main.php:45
30.0169873160mysqli_multi_row_query(  )...\Jobs.php:16
40.0169873344mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: XXXXXXXXXXXXXX  in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192
10.0004142312{main}(  )...\main.php:0
20.0169872992product_type_get_all(  )...\main.php:45
30.0169873160mysqli_multi_row_query(  )...\Jobs.php:16
40.0169873344mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: copps_installed_sales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192
10.0004142312{main}(  )...\main.php:0
20.0169872992product_type_get_all(  )...\main.php:45
30.0169873160mysqli_multi_row_query(  )...\Jobs.php:16
40.0169873344mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 151
10.0004142312{main}(  )...\main.php:0
20.0169872992product_type_get_all(  )...\main.php:45
30.0169873160mysqli_multi_row_query(  )...\Jobs.php:16
40.0309881048mysqli_query (  )...\MySQL.php:151



#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 155
10.0004142312{main}(  )...\main.php:0
20.0169872992product_type_get_all(  )...\main.php:45
30.0169873160mysqli_multi_row_query(  )...\Jobs.php:16
40.0338881088mysqli_error (  )...\MySQL.php:155



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: 192.168.0.225 in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 191
10.0004142312{main}(  )...\main.php:0
20.0365882448get_calendar_jobs(  )...\main.php:65
30.0365884408mysqli_multi_row_query(  )...\Jobs.php:406
40.0365884552mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: installedsales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192
10.0004142312{main}(  )...\main.php:0
20.0365882448get_calendar_jobs(  )...\main.php:65
30.0365884408mysqli_multi_row_query(  )...\Jobs.php:406
40.0365884552mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: XXXXXXXXXXXX in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192
10.0004142312{main}(  )...\main.php:0
20.0365882448get_calendar_jobs(  )...\main.php:65
30.0365884408mysqli_multi_row_query(  )...\Jobs.php:406
40.0365884552mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Notice: Undefined index: copps_installed_sales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192
10.0004142312{main}(  )...\main.php:0
20.0365882448get_calendar_jobs(  )...\main.php:65
30.0365884408mysqli_multi_row_query(  )...\Jobs.php:406
40.0365884552mysqli_initialize(  )...\MySQL.php:136



#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 151
10.0004142312{main}(  )...\main.php:0
20.0365882448get_calendar_jobs(  )...\main.php:65
30.0365884408mysqli_multi_row_query(  )...\Jobs.php:406
40.0521886440mysqli_query (  )...\MySQL.php:151



#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 155
10.0004142312{main}(  )...\main.php:0
20.0365882448get_calendar_jobs(  )...\main.php:65
30.0365884408mysqli_multi_row_query(  )...\Jobs.php:406
40.0555884696mysqli_error (  )...\MySQL.php:155



#TimeMemoryFunctionLocation
Call Stack
( ! ) Warning: Creating default object from empty value in C:\wamp\www\vrk\extensions\vrk\loop_item.Tag.php on line 26
10.0004142312{main}(  )...\main.php:0
20.0587882864display_html(  )...\main.php:85
30.0587883008Parser->build_output(  )...\Display.php:7
40.0593919776Parser->_parse_tags(  )...\Parser.php:60
50.0645975976loop_item->build(  )...\Parser.php:104



Let me try and modify mysqli_initialize function to better handle the connection handler
The purpose is to minimize changes and thus limit possible issues while achieving.

Please confirm within the MySQL log whether it is exceeding number of connections.

MySQL log is clean. I really appreciate what you have done so far.

Still looking to see what causes the errors,
Index where it exposes the parameters......

Try looking at the following, dealing with increasing the number of available connections on MySQL side.

https://www.rackaid.com/blog/mysql-connection-limits/

I added the following into the my.cnf file. It was not previously defined.


max_connections = 400
max_user_connections=200


No change unfortunately.

iN main.php what are you passing in the first argument for the connection.  Trying to see whether the simplest approach, is to update the mysqli_ functions to include the $connection->cur_DB as a means to provide the connection link to the DB.
Though the issue, your passing the installed_sales as the connection name, versus the connection reference. while you declare crk_connections as a global variable, the initialize keeps resettings.

Some of the errors in recent post deal with mysqli_error and mysqli_query related references.
make little sense when they spit out index error with data from the connection.xml info

what is in \oop_item.Tag.php?

Hi Arnold,


I have attached n

<?php
require_once("vrk/Kernel.php");

if (account_is_logged_in())
{
	// everyone has access to these options
	$applications = array(array("application_url" => "new_install.php?type=install", "application_name" => "New Install Quote Request")
						, array("application_url" => "new_install.php?type=material", "application_name" => "New Material Only Quote Request"));

	$show_jobs = "none";
	
	if (!account_is_in_users_group() || count(account_get_product_types()) > 0)
	{
		$show_jobs = "table-cell";
		$applications[] = array("application_url" => "job_search.php", "application_name" => "Job Search");
	}
	
	// add job type links, if not admin
	if (!account_is_admin())
	{
		$has_prod_type = false;
		foreach (account_get_product_types() as $product_type)
		{
			if (strpos($product_type, "Manage Staff") === false)
			{
				$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type, "application_name" => $product_type." Jobs");
				
				if (!product_type_exists($product_type))
				{
					// create product type
					product_type_create($product_type);
				}
			}
			$has_prod_type = true;
		}
		
		if ($has_prod_type)
		{
			$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
		}
	}
	else
	{
		// admins have access to all job types, get all job types and then add the menus
		foreach (product_type_get_all() as $product_type)
		{
			$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type["product_type"], "application_name" => $product_type["product_type"]." Jobs");
		}
		$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
	}
	
	if (account_manage_staff())
	{
		$applications[] = array("application_url" => "manage_staff.php", "application_name" => "Manage Staff");
	}
	
	// if admin add admin menu options
	if (account_is_admin())
	{
		$applications[] = array("application_url" => "admin_sub_menu.php", "application_name" => "Administrator");
		$applications[] = array("application_url" => "settings.php", "application_name" => "Settings");
	}
	
	$user = account_get_logged_in_name();
	$jobs = get_calendar_jobs(account_get_product_types());
	$out_jobs = array();
	
	foreach ($jobs as $job)
	{
		if (count($out_jobs) > 0 && $out_jobs[count($out_jobs) - 1]["work_date"] == $job["work_date"])
		{
			$out_jobs[count($out_jobs) - 1]["details"].= "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
															Customer: ".$job["customer_name"]."<br />
															Product Type: ".$job["product_type"]."<br /><br />";
		}
		else
		{
			$out_jobs[]["work_date"] = $job["work_date"];
			$out_jobs[count($out_jobs) - 1]["details"] = "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
									Customer: ".$job["customer_name"]."<br />
									Product Type: ".$job["product_type"]."<br /><br />";
		}
	}
	
	display_html("xmls/main.xml", "xmls/template.xml");
}
else
{
	header("Location: index.php");
}
?>

Open in new window


loop_item.Tag.php

<?php
/* Version 1.0.0 - 4:22 PM 18/07/2009 */

class loop_item extends ExtTag
{
	function load()
	{
	}
	
	function validate()
	{
		global $vrk_loop_stack;
		if ($vrk_loop_stack == NULL)
		{
			return $this->throw_missing_parent_ex("vrk:loop_item", "vrk:loop");
		}
	}

	function build()
	{
		global $vrk_loop_stack;
		if ($vrk_loop_stack->cur_loop->can_parse_loop_item())
		{
			if ($this->type != "close")
			{
				$vrk_loop_stack->current_loop->parse = true;
				$this->handle_loop();
				return $this->value;
			}
		}
	}
}
?>

Open in new window


ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Hi Arnold,


I think at this point I am way over my head so I am going to bow out. I am going to try and hire a PHP developer to see if the issue can be fixed. I appreciate all of the effort you have offered.

you might want to modernize versus having the new person go over old process.
It might be simpler to develop a new based on your years of use and possible additional features to be added, versus straight out repair of what you have.
Presumably your organization has grown over time, and might have additional items in mind.