From 466296e49bc9b71a106e2a63001a2a517fa24151 Mon Sep 17 00:00:00 2001 From: dixy Date: Thu, 20 Mar 2014 14:52:54 +0100 Subject: [PATCH] Use fetch_assoc instead of fetch_array --- php/modules/album.php | 2 +- php/modules/misc.php | 2 +- php/modules/photo.php | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/php/modules/album.php b/php/modules/album.php index 22e3db4..7c077d2 100755 --- a/php/modules/album.php +++ b/php/modules/album.php @@ -146,7 +146,7 @@ function getAlbum($albumID) { $result = $database->query($query); $previousPhotoID = ""; $i = 0; - while($row = $result->fetch_array()) { + while($row = $result->fetch_assoc()) { $return['content'][$row['id']]['id'] = $row['id']; $return['content'][$row['id']]['title'] = $row['title']; diff --git a/php/modules/misc.php b/php/modules/misc.php index fd72659..16e5a1a 100755 --- a/php/modules/misc.php +++ b/php/modules/misc.php @@ -47,7 +47,7 @@ function search($term) { // Photos $result = $database->query("SELECT id, title, tags, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%' OR tags like '%$term%';"); - while($row = $result->fetch_array()) { + while($row = $result->fetch_assoc()) { $return['photos'][$row['id']] = $row; $return['photos'][$row['id']]['sysdate'] = date('d F Y', strtotime($row['sysdate'])); } diff --git a/php/modules/photo.php b/php/modules/photo.php index 05a4cc1..f000c53 100755 --- a/php/modules/photo.php +++ b/php/modules/photo.php @@ -15,14 +15,14 @@ function getPhoto($photoID, $albumID) { $query = "SELECT * FROM lychee_photos WHERE id = '$photoID' LIMIT 1;"; $result = $database->query($query); - $return = $result->fetch_array(); + $return = $result->fetch_assoc(); if ($albumID!='false') { if ($return['album']!=0) { $result = $database->query("SELECT public FROM lychee_albums WHERE id = '" . $return['album'] . "';"); - $return_album = $result->fetch_array(); + $return_album = $result->fetch_assoc(); if ($return_album['public']=="1") $return['public'] = "2"; } @@ -36,11 +36,6 @@ function getPhoto($photoID, $albumID) { unset($return['album_public']); - // Remove unused items - foreach ($return as $key => $value) { - if (is_int($key)) unset($return[$key]); - } - return $return; }