Skip to content

Commit

Permalink
Adodb -> PDO
Browse files Browse the repository at this point in the history
  • Loading branch information
thekabal committed Feb 18, 2021
1 parent 164ae6e commit ba952b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
20 changes: 8 additions & 12 deletions classes/PlanetProduction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class PlanetProduction
{
public static function productionChange(\PDO $pdo_db, $old_db, string $lang, array $prodpercentarray, Registry $tkireg): void
public static function productionChange(\PDO $pdo_db, string $lang, array $prodpercentarray, Registry $tkireg): void
{
$langvars = Translate::load($pdo_db, $lang, array('common', 'planet_report'));
// Declare default production values from the config.php file
Expand Down Expand Up @@ -160,19 +160,15 @@ public static function productionChange(\PDO $pdo_db, $old_db, string $lang, arr
echo $langvars['l_pr_prod_updated'] . "<br><br>";
echo $langvars['l_pr_checking_values'] . "<br><br>";

$res = $old_db->Execute("SELECT * FROM {$old_db->prefix}planets WHERE owner = ? ORDER BY sector_id;", array($ship_id));
\Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
$counter = 0;
$planets = array();
if ($res)
{
while (!$res->EOF)
{
$planets[$counter] = $res->fields;
$counter++;
$res->MoveNext();
}
$sql = "SELECT * FROM ::prefix::planets WHERE owner = :owner ORDER BY sector_id";
$stmt = $pdo_db->prepare($sql);
$stmt->bindParam(':owner', $ship_id, \PDO::PARAM_INT);
$stmt->execute();
$planets = $stmt->fetchAll(\PDO::FETCH_ASSOC);

if (!empty($planets))
{
foreach ($planets as $planet)
{
if (empty($planet['name']))
Expand Down
2 changes: 1 addition & 1 deletion planet_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
{
$title = $title . ": Production";
echo "<h1>" . $title . "</h1>\n";
Tki\PlanetProduction::productionChange($pdo_db, $old_db, $lang, $sort, $tkireg);
Tki\PlanetProduction::productionChange($pdo_db, $lang, $sort, $tkireg);
}
elseif ($preptype == 0) // For typing in manually to get a report menu
{
Expand Down
2 changes: 1 addition & 1 deletion planet_report_ce.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}
else
{
Tki\PlanetProduction::productionChange($pdo_db, $old_db, $lang, $_POST, $tkireg);
Tki\PlanetProduction::productionChange($pdo_db, $lang, $_POST, $tkireg);
}

echo '<br><br>';
Expand Down

0 comments on commit ba952b3

Please sign in to comment.