changeset 105:3afe26a1d000

thule_fit_fits: use non-deprecated mysqli module
author paulo
date Mon, 23 Dec 2019 01:13:03 -0800
parents 4043aaa41075
children 712cc41e0be2
files thule_fit_kits/index.php
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/thule_fit_kits/index.php	Thu Mar 07 00:52:02 2019 -0800
     1.2 +++ b/thule_fit_kits/index.php	Mon Dec 23 01:13:03 2019 -0800
     1.3 @@ -35,18 +35,14 @@
     1.4  	include('../../login.php');
     1.5  	$database = 'pauloang_fitkits';
     1.6  
     1.7 -	$link = mysql_connect('localhost', $username, $password);
     1.8 -	if (!$link)
     1.9 -		die('Could not connect to MySQL server: ' . mysql_error());
    1.10 -
    1.11 -	$db_selected = mysql_select_db($database, $link);
    1.12 -	if (!$db_selected)
    1.13 -		die('Could not select database: ' . mysql_error());
    1.14 +	$mysqli = mysqli_connect('localhost', $username, $password, $database);
    1.15 +	if (mysqli_connect_errno())
    1.16 +		die('Could not connect to MySQL server/database: ' . mysqli_connect_error());
    1.17  
    1.18  	$query = 'SELECT * FROM Thule ORDER BY kit_id';
    1.19 -	$results = mysql_query($query);
    1.20 +	$results = mysqli_query($mysqli, $query);
    1.21  
    1.22 -	while ($row = mysql_fetch_assoc($results)) {
    1.23 +	while ($row = mysqli_fetch_assoc($results)) {
    1.24  		echo '<TR><TD><DIV class="kit_id">';
    1.25  		$pdf_filename = 'pdf/thule-fit-kit-' . $row['kit_id']. '-instructions.pdf';
    1.26  		if (file_exists($pdf_filename))
    1.27 @@ -76,8 +72,8 @@
    1.28  		echo '</TR>' . "\n";
    1.29  	}
    1.30  
    1.31 -	mysql_free_result($results);
    1.32 -	mysql_close($link);
    1.33 +	mysqli_free_result($results);
    1.34 +	mysqli_close($mysqli);
    1.35  
    1.36  ?>
    1.37