Add centralized DB helper; fix legacy mysql_error() landmines
- includes/db.php: shared mysqli connection + parameterized query helpers (pqs_db/pqs_exec/pqs_rows/pqs_row/pqs_val), targets PHP 7.4+. - Replace 11 mysql_error() calls (undefined function on PHP 7+) with mysqli_error($link) / mysqli_connect_error() across getFSgame, getFSplayers, config, callsign, console. Only affected already-failed error paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysql_error());
|
||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_connect_error());
|
||||
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
||||
$query = 'SELECT * FROM pqs_gameconfig';
|
||||
$result = mysqli_query($link, $query) or die('Query failed: ' . mysql_error());
|
||||
$result = mysqli_query($link, $query) or die('Query failed: ' . mysqli_error($link));
|
||||
while ($line = mysqli_fetch_array($result)) {
|
||||
$numpods[$line[0]] = $line[1];
|
||||
$timepergame[$line[0]] = $line[2];
|
||||
@@ -11,7 +11,7 @@ while ($line = mysqli_fetch_array($result)) {
|
||||
$groupAvalible[$line[0]] = $line[23];
|
||||
}
|
||||
$query = 'SELECT * FROM pqs_pods';
|
||||
$result = mysqli_query($link, $query) or die('Query failed: ' . mysql_error());
|
||||
$result = mysqli_query($link, $query) or die('Query failed: ' . mysqli_error($link));
|
||||
$pod01 = $line[0];
|
||||
$pod02 = $line[1];
|
||||
$pod03 = $line[2];
|
||||
|
||||
Reference in New Issue
Block a user