forked from Public/pics
		
	Database: address PHP 8.5 mysqli deprecation warning
This commit is contained in:
		
							parent
							
								
									d6a319b886
								
							
						
					
					
						commit
						7faa59562d
					
				@ -28,17 +28,17 @@ class Database
 | 
			
		||||
	 */
 | 
			
		||||
	public function __construct($server, $user, $password, $name)
 | 
			
		||||
	{
 | 
			
		||||
		$this->connection = @mysqli_connect($server, $user, $password, $name);
 | 
			
		||||
 | 
			
		||||
		// Give up if we have a connection error.
 | 
			
		||||
		if (mysqli_connect_error())
 | 
			
		||||
		try
 | 
			
		||||
		{
 | 
			
		||||
			header('HTTP/1.1 503 Service Temporarily Unavailable');
 | 
			
		||||
			$this->connection = new mysqli($server, $user, $password, $name);
 | 
			
		||||
			$this->connection->set_charset('utf8mb4');
 | 
			
		||||
		}
 | 
			
		||||
		catch (mysqli_sql_exception $e)
 | 
			
		||||
		{
 | 
			
		||||
			http_response_code(503);
 | 
			
		||||
			echo '<h2>Database Connection Problems</h2><p>Our software could not connect to the database. We apologise for any inconvenience and ask you to check back later.</p>';
 | 
			
		||||
			exit;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$this->query('SET NAMES {string:utf8mb4}', ['utf8mb4' => 'utf8mb4']);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getQueryCount()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user