Просмотр исходного кода

[Bugfix] Fix db in properties.php

Foppe Hemminga 5 лет назад
Родитель
Сommit
bfc88c2501
2 измененных файлов с 5 добавлено и 2 удалено
  1. 1 1
      functions.php
  2. 4 1
      properties.php

+ 1 - 1
functions.php

@@ -72,7 +72,7 @@ function add_player( $maintainer, $player ) {
 		// handle the exception here
 	}
 	$query = <<<QUERY
-	INSERT INTO player_properties (maintainer, player, property)
+	INSERT OR REPLACE INTO player_properties (maintainer, player, property)
 	VALUES (?, ?, ?)
 QUERY;
 	$stmt = $pdo->prepare( $query );

+ 4 - 1
properties.php

@@ -1,4 +1,7 @@
 <?php
+
+require "settings.php";
+
 $properties = json_decode( '{
 	"level": 95,
 	"gender": "Female",
@@ -165,7 +168,7 @@ print("</pre>");
 
 $pdo = null;
 try {
-	$pdo = new PDO("sqlite:" . './slork.sqlite');
+	$pdo = new PDO("sqlite:" . "${db_path}/slork.sqlite");
 } catch (PDOException $e) {
 	// handle the exception here
 }