aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2009-11-15 12:26:09 +0000
committernikrou <nikrou@piwigo.org>2009-11-15 12:26:09 +0000
commit1040cae2104259fdec8543e0a41ac63cbe24c69c (patch)
treef1a08573c7d2bdf1b8634263226fd42de7088848
parentdda7f4571b72323c4e53ce5ef4a42412b65da3bd (diff)
Feature 1241 resolved. replace mysql_fetch_array by mysql_fetch_assoc for small php code improvements
git-svn-id: http://piwigo.org/svn/trunk@4265 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/cat_modify.php4
-rw-r--r--admin/cat_perm.php10
-rw-r--r--admin/configuration.php2
-rw-r--r--admin/element_set.php2
-rw-r--r--admin/element_set_global.php2
-rw-r--r--admin/element_set_ranks.php2
-rw-r--r--admin/element_set_unit.php2
-rw-r--r--admin/group_list.php2
-rw-r--r--admin/group_perm.php6
-rw-r--r--admin/history.php6
-rw-r--r--admin/include/c13y_internal.class.php2
-rw-r--r--admin/include/functions.php44
-rw-r--r--admin/include/functions_metadata.php4
-rw-r--r--admin/include/functions_notification_by_mail.inc.php2
-rw-r--r--admin/include/functions_permalinks.php4
-rw-r--r--admin/notification_by_mail.php4
-rw-r--r--admin/picture_modify.php6
-rw-r--r--admin/rating.php4
-rw-r--r--admin/site_manager.php6
-rw-r--r--admin/site_update.php14
-rw-r--r--admin/stats.php4
-rw-r--r--admin/tags.php4
-rw-r--r--admin/upload.php4
-rw-r--r--admin/user_list.php6
-rw-r--r--admin/user_perm.php8
-rw-r--r--include/calendar_monthly.class.php6
-rw-r--r--include/category_cats.inc.php2
-rw-r--r--include/functions.inc.php12
-rw-r--r--include/functions_category.inc.php8
-rw-r--r--include/functions_mail.inc.php6
-rw-r--r--include/functions_notification.inc.php4
-rw-r--r--include/functions_plugins.inc.php2
-rw-r--r--include/functions_search.inc.php2
-rw-r--r--include/functions_user.inc.php20
-rw-r--r--include/picture_comment.inc.php4
-rw-r--r--include/picture_rate.inc.php4
-rw-r--r--install/db/12-database.php2
-rw-r--r--install/db/18-database.php2
-rw-r--r--install/db/19-database.php2
-rw-r--r--install/db/20-database.php2
-rw-r--r--install/db/65-database.php4
-rw-r--r--install/db/8-database.php2
-rw-r--r--install/db/9-database.php2
-rw-r--r--install/upgrade_1.3.0.php2
-rw-r--r--install/upgrade_1.3.1.php8
-rw-r--r--install/upgrade_1.4.0.php4
-rw-r--r--install/upgrade_1.5.0.php6
-rw-r--r--password.php2
-rw-r--r--picture.php6
-rw-r--r--search_rules.php2
-rw-r--r--upload.php2
51 files changed, 136 insertions, 136 deletions
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index 1c740305c..1ca146aa6 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -193,7 +193,7 @@ SELECT *
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$_GET['cat_id'].'
;';
-$category = mysql_fetch_array( pwg_query( $query ) );
+$category = mysql_fetch_assoc( pwg_query( $query ) );
// nullable fields
foreach (array('comment','dir','site_id', 'id_uppercat') as $nullable)
{
@@ -373,7 +373,7 @@ SELECT id,tn_ext,path
FROM '.IMAGES_TABLE.'
WHERE id = '.$category['representative_picture_id'].'
;';
- $row = mysql_fetch_array(pwg_query($query));
+ $row = mysql_fetch_assoc(pwg_query($query));
$src = get_thumbnail_url($row);
$url = get_root_url().'admin.php?page=picture_modify';
$url.= '&amp;image_id='.$category['representative_picture_id'];
diff --git a/admin/cat_perm.php b/admin/cat_perm.php
index ed0257bc4..0107d6cc7 100644
--- a/admin/cat_perm.php
+++ b/admin/cat_perm.php
@@ -45,7 +45,7 @@ SELECT status
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$_GET['cat'].'
;';
- list($status) = mysql_fetch_array(pwg_query($query));
+ list($status) = mysql_fetch_row(pwg_query($query));
if ('private' == $status)
{
@@ -62,7 +62,7 @@ SELECT id
LIMIT 0,1
;';
- list($page['cat']) = mysql_fetch_array(pwg_query($query));
+ list($page['cat']) = mysql_fetch_row(pwg_query($query));
}
// +-----------------------------------------------------------------------+
@@ -110,7 +110,7 @@ SELECT group_id, cat_id
AND group_id IN ('.implode(',', $_POST['grant_groups']).')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($granteds[$row['cat_id']], $row['group_id']);
}
@@ -169,7 +169,7 @@ SELECT user_id, cat_id
AND user_id IN ('.implode(',', $_POST['grant_users']).')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($granteds[$row['cat_id']], $row['user_id']);
}
@@ -274,7 +274,7 @@ SELECT user_id, group_id
WHERE group_id IN ('.implode(',', $group_granted_ids).')
';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if (!isset($granted_groups[$row['group_id']]))
{
diff --git a/admin/configuration.php b/admin/configuration.php
index a0df63190..d193f9f8d 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -138,7 +138,7 @@ if (isset($_POST['submit']) and !is_adviser())
{
//echo '<pre>'; print_r($_POST); echo '</pre>';
$result = pwg_query('SELECT param FROM '.CONFIG_TABLE);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if (isset($_POST[$row['param']]))
{
diff --git a/admin/element_set.php b/admin/element_set.php
index 821c4e188..9cbdb7eec 100644
--- a/admin/element_set.php
+++ b/admin/element_set.php
@@ -192,7 +192,7 @@ elseif ('recent'== $_GET['cat'])
$page['title'] = l10n('recent_pics_cat');
$query = 'SELECT MAX(date_available) AS date
FROM '.IMAGES_TABLE;
- if ($row=mysql_fetch_array( pwg_query($query) ) )
+ if ($row = mysql_fetch_assoc( pwg_query($query) ) )
{
$query = 'SELECT id
FROM '.IMAGES_TABLE.'
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index 4f223b2cc..20a4c658b 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -245,7 +245,7 @@ SELECT id
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$data = array();
$data['id'] = $row['id'];
diff --git a/admin/element_set_ranks.php b/admin/element_set_ranks.php
index c8ab6eebf..1bc0ab57f 100644
--- a/admin/element_set_ranks.php
+++ b/admin/element_set_ranks.php
@@ -115,7 +115,7 @@ SELECT uppercats
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$page['category_id'].'
;';
-$category = mysql_fetch_array(pwg_query($query));
+$category = mysql_fetch_assoc(pwg_query($query));
// Navigation path
$navigation = get_cat_display_name_cache(
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index 67f5a62e6..7bc0e54b0 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -56,7 +56,7 @@ SELECT id, date_creation
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$data = array();
diff --git a/admin/group_list.php b/admin/group_list.php
index ab2e8ae7c..97ee5a8f3 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -175,7 +175,7 @@ $del_url = $admin_url.'group_list&amp;delete=';
$members_url = $admin_url.'user_list&amp;group=';
$toggle_is_default_url = $admin_url.'group_list&amp;toggle_is_default=';
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$query = '
SELECT COUNT(*)
diff --git a/admin/group_perm.php b/admin/group_perm.php
index 7b8538c6c..89a8b43ae 100644
--- a/admin/group_perm.php
+++ b/admin/group_perm.php
@@ -79,7 +79,7 @@ SELECT id
AND status = \'private\'
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($private_uppercats, $row['id']);
}
@@ -96,7 +96,7 @@ SELECT cat_id
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($authorized_ids, $row['cat_id']);
}
@@ -157,7 +157,7 @@ display_select_cat_wrapper($query_true,array(),'category_option_true');
$result = pwg_query($query_true);
$authorized_ids = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push($authorized_ids, $row['id']);
}
diff --git a/admin/history.php b/admin/history.php
index c357a498f..1560d428b 100644
--- a/admin/history.php
+++ b/admin/history.php
@@ -257,7 +257,7 @@ SELECT '.$conf['user_fields']['id'].' AS id
$result = pwg_query($query);
$username_of = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$username_of[$row['id']] = $row['username'];
}
@@ -305,7 +305,7 @@ SELECT
$tn_ext_of_image = array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$label_of_image[ $row['id'] ] = $row['label'];
@@ -341,7 +341,7 @@ SELECT
$name_of_tag = array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$name_of_tag[ $row['id'] ] = $row['name'];
}
diff --git a/admin/include/c13y_internal.class.php b/admin/include/c13y_internal.class.php
index 8065cbbb2..c807ac24c 100644
--- a/admin/include/c13y_internal.class.php
+++ b/admin/include/c13y_internal.class.php
@@ -126,7 +126,7 @@ class c13y_internal
$status = array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$status[$row['id']] = $row['status'];
}
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 63a79a2bf..f023a7a5d 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -36,7 +36,7 @@ SELECT id
;';
$result = pwg_query($query);
$category_ids = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($category_ids, $row['id']);
}
@@ -77,7 +77,7 @@ SELECT id
;';
$result = pwg_query($query);
$element_ids = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($element_ids, $row['id']);
}
@@ -544,7 +544,7 @@ SHOW FULL COLUMNS FROM '.$tablename;
$result = pwg_query($query);
$columns = array();
$all_fields = array_merge($dbfields['primary'], $dbfields['update']);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if (in_array($row['Field'], $all_fields))
{
@@ -630,7 +630,7 @@ SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat, uppercats, r
$current_uppercat = '';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if ($row['id_uppercat'] != $current_uppercat)
{
@@ -776,7 +776,7 @@ SELECT uppercats
WHERE id IN ('.implode(',', $cat_ids).')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$uppercats = array_merge($uppercats,
explode(',', $row['uppercats']));
@@ -803,7 +803,7 @@ SELECT image_id
ORDER BY RAND()
LIMIT 0,1
;';
- list($representative) = mysql_fetch_array(pwg_query($query));
+ list($representative) = mysql_fetch_row(pwg_query($query));
array_push(
$datas,
@@ -863,7 +863,7 @@ SELECT id, uppercats, site_id
'.wordwrap(implode(', ', $cat_ids), 80, "\n").')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($categories, $row);
}
@@ -1139,7 +1139,7 @@ SELECT element_id,
$datas = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push(
$datas,
@@ -1206,7 +1206,7 @@ SELECT id, id_uppercat, status, uppercats
WHERE id IN ('.implode(',', $category_ids).')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$categories[$row['id']] =
array(
@@ -1355,7 +1355,7 @@ SELECT MAX(rank)
FROM '.CATEGORIES_TABLE.'
WHERE id_uppercat '.(is_numeric($parent_id) ? '= '.$parent_id : 'IS NULL').'
;';
- list($current_rank) = mysql_fetch_array(pwg_query($query));
+ list($current_rank) = mysql_fetch_row(pwg_query($query));
$insert = array(
'name' => $category_name,
@@ -1371,21 +1371,21 @@ SELECT id, uppercats, global_rank, visible, status
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$parent_id.'
;';
- $parent = mysql_fetch_array(pwg_query($query));
+ $parent = mysql_fetch_assoc(pwg_query($query));
- $insert{'id_uppercat'} = $parent{'id'};
- $insert{'global_rank'} = $parent{'global_rank'}.'.'.$insert{'rank'};
+ $insert['id_uppercat'] = $parent['id'];
+ $insert['global_rank'] = $parent['global_rank'].'.'.$insert['rank'];
// at creation, must a category be visible or not ? Warning : if the
// parent category is invisible, the category is automatically create
// invisible. (invisible = locked)
if ('false' == $parent['visible'])
{
- $insert{'visible'} = 'false';
+ $insert['visible'] = 'false';
}
else
{
- $insert{'visible'} = boolean_to_string($conf['newcat_default_visible']);
+ $insert['visible'] = boolean_to_string($conf['newcat_default_visible']);
}
// at creation, must a category be public or private ? Warning : if the
@@ -1393,18 +1393,18 @@ SELECT id, uppercats, global_rank, visible, status
// private.
if ('private' == $parent['status'])
{
- $insert{'status'} = 'private';
+ $insert['status'] = 'private';
}
else
{
- $insert{'status'} = $conf['newcat_default_status'];
+ $insert['status'] = $conf['newcat_default_status'];
}
}
else
{
- $insert{'visible'} = boolean_to_string($conf['newcat_default_visible']);
- $insert{'status'} = $conf['newcat_default_status'];
- $insert{'global_rank'} = $insert{'rank'};
+ $insert['visible'] = boolean_to_string($conf['newcat_default_visible']);
+ $insert['status'] = $conf['newcat_default_status'];
+ $insert['global_rank'] = $insert['rank'];
}
// we have then to add the virtual category
@@ -1609,7 +1609,7 @@ function do_maintenance_all_tables()
// List all tables
$query = 'SHOW TABLES LIKE \''.$prefixeTable.'%\'';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($all_tables, $row[0]);
}
@@ -1625,7 +1625,7 @@ function do_maintenance_all_tables()
$query = 'DESC '.$table_name.';';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if ($row['Key'] == 'PRI')
{
diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php
index c015b9e91..5bf36439d 100644
--- a/admin/include/functions_metadata.php
+++ b/admin/include/functions_metadata.php
@@ -259,7 +259,7 @@ SELECT id
$query.= '
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($cat_ids, $row['id']);
}
@@ -284,7 +284,7 @@ SELECT id, path
$query.= '
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$files[$row['id']] = $row['path'];
}
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index 9f631560b..11b9454f4 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -167,7 +167,7 @@ order by';
$result = pwg_query($query);
if (!empty($result))
{
- while ($nbm_user = mysql_fetch_array($result))
+ while ($nbm_user = mysql_fetch_assoc($result))
{
array_push($data_users, $nbm_user);
}
diff --git a/admin/include/functions_permalinks.php b/admin/include/functions_permalinks.php
index e0a024161..85820dba2 100644
--- a/admin/include/functions_permalinks.php
+++ b/admin/include/functions_permalinks.php
@@ -52,7 +52,7 @@ SELECT c.id
$result = pwg_query($query);
$cat_id = null;
if ( mysql_num_rows($result) )
- list( $cat_id ) = mysql_fetch_array($result);
+ list( $cat_id ) = mysql_fetch_row($result);
return $cat_id;
}
@@ -74,7 +74,7 @@ SELECT permalink
$result = pwg_query($query);
if ( mysql_num_rows($result) )
{
- list($permalink) = mysql_fetch_array($result);
+ list($permalink) = mysql_fetch_row($result);
}
if ( !isset($permalink) )
{// no permalink; nothing to do
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index 0da5ccbab..11863b7f5 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -150,7 +150,7 @@ order by
$inserts = array();
$check_key_list = array();
- while ($nbm_user = mysql_fetch_array($result))
+ while ($nbm_user = mysql_fetch_assoc($result))
{
// Calculate key
$nbm_user['check_key'] = find_available_check_key();
@@ -512,7 +512,7 @@ switch ($page['mode'])
$updated_param_count = 0;
// Update param
$result = pwg_query('select param, value from '.CONFIG_TABLE.' where param like \'nbm\\_%\'');
- while ($nbm_user = mysql_fetch_array($result))
+ while ($nbm_user = mysql_fetch_assoc($result))
{
if (isset($_POST[$nbm_user['param']]))
{
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index c142ae955..30b9db972 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -175,7 +175,7 @@ SELECT *
FROM '.IMAGES_TABLE.'
WHERE id = '.$_GET['image_id'].'
;';
-$row = mysql_fetch_array(pwg_query($query));
+$row = mysql_fetch_assoc(pwg_query($query));
$storage_category_id = null;
if (!empty($row['storage_category_id']))
@@ -324,7 +324,7 @@ SELECT category_id, uppercats
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$name =
get_cat_display_name_cache(
@@ -417,7 +417,7 @@ if (isset($storage_category_id))
{
array_push($associateds, $storage_category_id);
}
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push($associateds, $row['id']);
}
diff --git a/admin/rating.php b/admin/rating.php
index e2f614abe..da19b6b7a 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -94,7 +94,7 @@ SELECT '.$conf['user_fields']['username'].' as username, '.$conf['user_fields'][
FROM '.USERS_TABLE.'
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$users[$row['id']]=$row['username'];
}
@@ -214,7 +214,7 @@ ORDER BY date DESC;';
'rates' => array()
);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$url_del = PHPWG_ROOT_PATH.'admin.php'.
diff --git a/admin/site_manager.php b/admin/site_manager.php
index 06687a274..faec41166 100644
--- a/admin/site_manager.php
+++ b/admin/site_manager.php
@@ -98,7 +98,7 @@ SELECT COUNT(id) AS count
FROM '.SITES_TABLE.'
WHERE galleries_url = \''.$url.'\'
;';
- $row = mysql_fetch_array(pwg_query($query));
+ $row = mysql_fetch_assoc(pwg_query($query));
if ($row['count'] > 0)
{
array_push($page['errors'],
@@ -167,7 +167,7 @@ SELECT galleries_url
FROM '.SITES_TABLE.'
WHERE id = '.$page['site'].'
;';
- list($galleries_url) = mysql_fetch_array(pwg_query($query));
+ list($galleries_url) = mysql_fetch_row(pwg_query($query));
switch($_GET['action'])
{
case 'generate' :
@@ -236,7 +236,7 @@ SELECT *
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$is_remote = url_is_remote($row['galleries_url']);
$base_url = PHPWG_ROOT_PATH.'admin.php';
diff --git a/admin/site_update.php b/admin/site_update.php
index b260a5db9..543c7f718 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -185,7 +185,7 @@ SELECT id, uppercats, global_rank, status, visible
SELECT id
FROM '.CATEGORIES_TABLE;
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$next_rank[$row['id']] = 1;
}
@@ -196,7 +196,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
FROM '.CATEGORIES_TABLE.'
GROUP BY id_uppercat';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
// for the id_uppercat NULL, we write 'NULL' and not the empty string
if (!isset($row['id_uppercat']) or $row['id_uppercat'] == '')
@@ -210,7 +210,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
$query = '
SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
FROM '.CATEGORIES_TABLE;
- list($next_id) = mysql_fetch_array(pwg_query($query));
+ list($next_id) = mysql_fetch_row(pwg_query($query));
// retrieve sub-directories fulldirs from the site reader
$fs_fulldirs = $site_reader->get_full_directories($basedir);
@@ -386,7 +386,7 @@ SELECT file,storage_category_id
'.wordwrap(implode(', ', $cat_ids), 80, "\n").')
AND validated = \'false\'';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push(
$db_unvalidated,
@@ -402,7 +402,7 @@ SELECT file,storage_category_id
$query = '
SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
FROM '.IMAGES_TABLE;
- list($next_element_id) = mysql_fetch_array(pwg_query($query));
+ list($next_element_id) = mysql_fetch_row(pwg_query($query));
$start = get_moment();
@@ -555,7 +555,7 @@ SELECT id,file,storage_category_id,infos
$waiting_to_delete = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$data = array();
@@ -564,7 +564,7 @@ SELECT id
FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$row['storage_category_id'].'
AND file = \''.$row['file'].'\'';
- list($data['id']) = mysql_fetch_array(pwg_query($query));
+ list($data['id']) = mysql_fetch_row(pwg_query($query));
foreach ($fields['update'] as $field)
{
diff --git a/admin/stats.php b/admin/stats.php
index 0ecfd3f50..600cfcb6e 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -95,7 +95,7 @@ SELECT
$result = pwg_query($query);
$output = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($output, $row);
}
@@ -133,7 +133,7 @@ $max_id = 0;
$is_first = true;
$first_time_key = null;
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$time_keys = array(
substr($row['date'], 0, 4), //yyyy
diff --git a/admin/tags.php b/admin/tags.php
index c4548ef8b..94c5bcb3d 100644
--- a/admin/tags.php
+++ b/admin/tags.php
@@ -49,7 +49,7 @@ SELECT id, name
WHERE id IN ('.$_POST['edit_list'].')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$current_name_of[ $row['id'] ] = $row['name'];
}
@@ -220,7 +220,7 @@ SELECT id, name
WHERE id IN ('.implode(',', $_POST['tags']).')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$name_of[ $row['id'] ] = $row['name'];
}
diff --git a/admin/upload.php b/admin/upload.php
index a8b88ccf2..b36906778 100644
--- a/admin/upload.php
+++ b/admin/upload.php
@@ -100,7 +100,7 @@ SELECT id, storage_category_id, file, tn_ext
WHERE id IN ('.implode(',', $to_reject).')
;';
$result = pwg_query($query);
- while($row = mysql_fetch_array($result))
+ while($row = mysql_fetch_assoc($result))
{
$dir = get_complete_dir($row['storage_category_id']);
unlink($dir.$row['file']);
@@ -153,7 +153,7 @@ $query.= " WHERE validated = 'false'";
$query.= ' ORDER BY storage_category_id';
$query.= ';';
$result = pwg_query( $query );
-while ( $row = mysql_fetch_array( $result ) )
+while ( $row = mysql_fetch_assoc( $result ) )
{
if ( !isset( $cat_names[$row['storage_category_id']] ) )
{
diff --git a/admin/user_list.php b/admin/user_list.php
index 45e4380a5..73c1537bb 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -115,7 +115,7 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$user = $row;
$user['groups'] = array();
@@ -139,7 +139,7 @@ SELECT user_id, group_id
WHERE user_id IN ('.implode(',', $user_ids).')
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push(
$users[$user_nums[$row['user_id']]]['groups'],
@@ -492,7 +492,7 @@ SELECT id, name
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$groups[$row['id']] = $row['name'];
}
diff --git a/admin/user_perm.php b/admin/user_perm.php
index b8ad21edf..1d3b300f0 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -78,7 +78,7 @@ SELECT id
AND status = \'private\'
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($private_uppercats, $row['id']);
}
@@ -95,7 +95,7 @@ SELECT cat_id
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($authorized_ids, $row['cat_id']);
}
@@ -158,7 +158,7 @@ $result = pwg_query($query);
if (mysql_num_rows($result) > 0)
{
$cats = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($cats, $row);
array_push($group_authorized, $row['cat_id']);
@@ -191,7 +191,7 @@ display_select_cat_wrapper($query_true,array(),'category_option_true');
$result = pwg_query($query_true);
$authorized_ids = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push($authorized_ids, $row['id']);
}
diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php
index 4a25e0ee4..b4df9f5f8 100644
--- a/include/calendar_monthly.class.php
+++ b/include/calendar_monthly.class.php
@@ -231,7 +231,7 @@ function build_global_calendar(&$tpl_var)
$result = pwg_query($query);
$items=array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$y = substr($row['period'], 0, 4);
$m = (int)substr($row['period'], 4, 2);
@@ -283,7 +283,7 @@ function build_year_calendar(&$tpl_var)
$result = pwg_query($query);
$items=array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$m = (int)substr($row['period'], 0, 2);
$d = substr($row['period'], 2, 2);
@@ -333,7 +333,7 @@ function build_month_calendar(&$tpl_var)
$items=array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$d = (int)$row['period'];
$items[$d] = array('nb_images'=>$row['count']);
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 43f4776fc..1cd7c0407 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -178,7 +178,7 @@ SELECT
GROUP BY category_id
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$dates_of_category[ $row['category_id'] ] = array(
'from' => $row['date_creation_min'],
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 84bf02460..7353eda6a 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -44,7 +44,7 @@ function get_enums($table, $field)
// retrieving the properties of the table. Each line represents a field :
// columns are 'Field', 'Type'
$result = pwg_query('desc '.$table);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
// we are only interested in the the field given in parameter for the
// function
@@ -935,7 +935,7 @@ function array_from_query($query, $fieldname)
$array = array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($array, $row[$fieldname]);
}
@@ -1121,7 +1121,7 @@ SELECT '.$conf['user_fields']['email'].'
FROM '.USERS_TABLE.'
WHERE '.$conf['user_fields']['id'].' = '.$conf['webmaster_id'].'
;';
- list($email) = mysql_fetch_array(pwg_query($query));
+ list($email) = mysql_fetch_row(pwg_query($query));
return $email;
}
@@ -1147,7 +1147,7 @@ SELECT param, value
fatal_error('No configuration data');
}
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : '';
@@ -1192,7 +1192,7 @@ function simple_hash_from_query($query, $keyname, $valuename)
$array = array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$array[ $row[$keyname] ] = $row[$valuename];
}
@@ -1584,7 +1584,7 @@ function get_icon($date, $is_child_date = false)
{
// Use MySql date in order to standardize all recent "actions/queries"
list($cache['get_icon']['sql_recent_date']) =
- mysql_fetch_array(pwg_query('select SUBDATE(
+ mysql_fetch_row(pwg_query('select SUBDATE(
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
}
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index a96347258..dd2707b10 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -240,7 +240,7 @@ function get_local_dir( $category_id )
$query = 'SELECT uppercats';
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id = '.$category_id;
$query.= ';';
- $row = mysql_fetch_array( pwg_query( $query ) );
+ $row = mysql_fetch_assoc( pwg_query( $query ) );
$uppercats = $row['uppercats'];
}
@@ -251,7 +251,7 @@ function get_local_dir( $category_id )
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id IN ('.$uppercats.')';
$query.= ';';
$result = pwg_query( $query );
- while( $row = mysql_fetch_array( $result ) )
+ while( $row = mysql_fetch_assoc( $result ) )
{
$database_dirs[$row['id']] = $row['dir'];
}
@@ -275,7 +275,7 @@ SELECT galleries_url
WHERE s.id = c.site_id
AND c.id = '.$category_id.'
;';
- $row = mysql_fetch_array(pwg_query($query));
+ $row = mysql_fetch_assoc(pwg_query($query));
return $row['galleries_url'];
}
@@ -384,7 +384,7 @@ SELECT DISTINCT(id)
$result = pwg_query($query);
$subcats = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($subcats, $row['id']);
}
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index f1e0ba4ff..905ad3e70 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -351,7 +351,7 @@ order by
$datas = pwg_query($query);
if (!empty($datas))
{
- while ($admin = mysql_fetch_array($datas))
+ while ($admin = mysql_fetch_assoc($datas))
{
if (!empty($admin['mail_address']))
{
@@ -450,7 +450,7 @@ WHERE
if (mysql_num_rows($result) > 0)
{
$list = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$row['template_theme'] = $row['template'];
list($row['template'], $row['theme']) = explode('/', $row['template_theme']);
@@ -479,7 +479,7 @@ WHERE
if (mysql_num_rows($result) > 0)
{
$Bcc = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if (!empty($row['mail_address']))
{
diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php
index 7e630439c..5bc3e56b8 100644
--- a/include/functions_notification.inc.php
+++ b/include/functions_notification.inc.php
@@ -145,7 +145,7 @@ function custom_notification_query($action, $type, $start, $end)
}
$query = 'SELECT count(distinct '.$field_id.') as CountId
'.$query;
- list($count) = mysql_fetch_array(pwg_query($query));
+ list($count) = mysql_fetch_row(pwg_query($query));
return $count;
break;
@@ -178,7 +178,7 @@ function custom_notification_query($action, $type, $start, $end)
$infos = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($infos, $row);
}
diff --git a/include/functions_plugins.inc.php b/include/functions_plugins.inc.php
index 5a5ea79e3..9f1ecac01 100644
--- a/include/functions_plugins.inc.php
+++ b/include/functions_plugins.inc.php
@@ -238,7 +238,7 @@ SELECT * FROM '.PLUGINS_TABLE;
$result = pwg_query($query);
$plugins = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($plugins, $row);
}
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index fcd58ceff..d9e424471 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -458,7 +458,7 @@ SELECT i.id,
$by_weights=array();
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{ // weight is important when sorting images by relevance
if ($row['weight'])
{
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 98a417ecb..c1f7029d4 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -58,7 +58,7 @@ from '.USERS_TABLE.'
where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
'.(is_numeric($user_id) ? 'and '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').'
;';
- list($count) = mysql_fetch_array(pwg_query($query));
+ list($count) = mysql_fetch_row(pwg_query($query));
if ($count != 0)
{
return l10n('reg_err_mail_address_dbl');
@@ -110,7 +110,7 @@ function register_user($login, $password, $mail_address,
SELECT MAX('.$conf['user_fields']['id'].') + 1
FROM '.USERS_TABLE.'
;';
- list($next_id) = mysql_fetch_array(pwg_query($query));
+ list($next_id) = mysql_fetch_row(pwg_query($query));
$insert =
array(
@@ -134,7 +134,7 @@ SELECT id
$result = pwg_query($query);
$inserts = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push
(
@@ -249,7 +249,7 @@ SELECT ';
FROM '.USERS_TABLE.'
WHERE '.$conf['user_fields']['id'].' = \''.$user_id.'\'';
- $row = mysql_fetch_array(pwg_query($query));
+ $row = mysql_fetch_assoc(pwg_query($query));
while (true)
{
@@ -269,7 +269,7 @@ SELECT ui.*, uc.*
}
}
- $row = array_merge($row, mysql_fetch_array($result));
+ $row = array_merge($row, mysql_fetch_assoc($result));
foreach ($row as $key => $value)
{
@@ -324,7 +324,7 @@ SELECT COUNT(DISTINCT(image_id)) as total
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id NOT IN ('.$userdata['forbidden_categories'].')
AND image_id '.$userdata['image_access_type'].' ('.$userdata['image_access_list'].')';
- list($userdata['nb_total_images']) = mysql_fetch_array(pwg_query($query));
+ list($userdata['nb_total_images']) = mysql_fetch_row(pwg_query($query));
// now we update user cache categories
@@ -428,7 +428,7 @@ SELECT DISTINCT f.image_id
;';
$result = pwg_query($query);
$authorizeds = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($authorizeds, $row['image_id']);
}
@@ -440,7 +440,7 @@ SELECT image_id
;';
$result = pwg_query($query);
$favorites = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($favorites, $row['image_id']);
}
@@ -481,7 +481,7 @@ SELECT id
WHERE status = \'private\'
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($private_array, $row['id']);
}
@@ -523,7 +523,7 @@ SELECT id
WHERE visible = \'false\'
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($forbidden_array, $row['id']);
}
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index 5ebf08fc9..a0aed7a70 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -93,7 +93,7 @@ if ($page['show_comments'])
SELECT COUNT(*) AS nb_comments
FROM '.COMMENTS_TABLE.'
WHERE image_id='.$page['image_id']." AND validated = 'true'";
- $row = mysql_fetch_array( pwg_query( $query ) );
+ $row = mysql_fetch_assoc( pwg_query( $query ) );
// navigation bar creation
if (!isset($page['start']))
@@ -140,7 +140,7 @@ $validated_clause.'
;';
$result = pwg_query( $query );
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if (!empty($row['author']))
{
diff --git a/include/picture_rate.inc.php b/include/picture_rate.inc.php
index bfb99453c..3543cfa37 100644
--- a/include/picture_rate.inc.php
+++ b/include/picture_rate.inc.php
@@ -37,7 +37,7 @@ SELECT COUNT(rate) AS count
FROM '.RATE_TABLE.'
WHERE element_id = '.$picture['current']['id'].'
;';
- $row = mysql_fetch_array(pwg_query($query));
+ $row = mysql_fetch_assoc(pwg_query($query));
}
else
{ // avg rate null -> no rate -> no need to query db
@@ -69,7 +69,7 @@ SELECT COUNT(rate) AS count
$result = pwg_query($query);
if (mysql_num_rows($result) > 0)
{
- $row = mysql_fetch_array($result);
+ $row = mysql_fetch_assoc($result);
$user_rate = $row['rate'];
}
}
diff --git a/install/db/12-database.php b/install/db/12-database.php
index c48285e36..5ccadd324 100644
--- a/install/db/12-database.php
+++ b/install/db/12-database.php
@@ -66,7 +66,7 @@ $result = pwg_query($query);
$datas = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push(
$datas,
diff --git a/install/db/18-database.php b/install/db/18-database.php
index cd1f2a793..9843fb6af 100644
--- a/install/db/18-database.php
+++ b/install/db/18-database.php
@@ -47,7 +47,7 @@ $result = pwg_query($query);
$datas = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push(
$datas,
diff --git a/install/db/19-database.php b/install/db/19-database.php
index 4dfdf38d0..709e23bde 100644
--- a/install/db/19-database.php
+++ b/install/db/19-database.php
@@ -68,7 +68,7 @@ SELECT id, keywords
WHERE keywords IS NOT NULL
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
foreach(preg_split('/[,]+/', $row['keywords']) as $keyword)
{
diff --git a/install/db/20-database.php b/install/db/20-database.php
index 25935f5de..9a29624b1 100644
--- a/install/db/20-database.php
+++ b/install/db/20-database.php
@@ -47,7 +47,7 @@ SELECT category_id, image_id
$result = pwg_query($query);
$datas = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push(
$datas,
diff --git a/install/db/65-database.php b/install/db/65-database.php
index 28988816c..b6a5a0a74 100644
--- a/install/db/65-database.php
+++ b/install/db/65-database.php
@@ -165,7 +165,7 @@ SELECT language FROM '.USER_INFOS_TABLE.'
$all_tables = array();
$query = 'SHOW TABLES LIKE "'.$prefixeTable.'%"';
$result = pwg_query($query);
- while ( $row=mysql_fetch_array($result) )
+ while ( $row=mysql_fetch_assoc($result) )
{
array_push($all_tables, $row[0]);
}
@@ -176,7 +176,7 @@ SELECT language FROM '.USER_INFOS_TABLE.'
$query = 'SHOW FULL COLUMNS FROM '.$table;
$result = pwg_query($query);
$field_definitions=array();
- while ( $row=mysql_fetch_array($result) )
+ while ( $row=mysql_fetch_assoc($result) )
{
if ( !isset($row['Collation']) or $row['Collation']=='NULL' )
continue;
diff --git a/install/db/8-database.php b/install/db/8-database.php
index 3f859a7e6..de742dcf7 100644
--- a/install/db/8-database.php
+++ b/install/db/8-database.php
@@ -60,7 +60,7 @@ $conf = $conf_save;
// +-Do I already have them in DB ?----------------------------------------+
$query = 'SELECT param FROM '.PREFIX_TABLE.'config';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
unset( $params[ $row['param'] ] );
}
diff --git a/install/db/9-database.php b/install/db/9-database.php
index 6ce738e02..77f92c008 100644
--- a/install/db/9-database.php
+++ b/install/db/9-database.php
@@ -47,7 +47,7 @@ $result = pwg_query($query);
$datas = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push(
$datas,
diff --git a/install/upgrade_1.3.0.php b/install/upgrade_1.3.0.php
index 831aa858f..761e016b0 100644
--- a/install/upgrade_1.3.0.php
+++ b/install/upgrade_1.3.0.php
@@ -84,7 +84,7 @@ SELECT id, id_uppercat
FROM '.CATEGORIES_TABLE.'
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['id_uppercat']) or $row['id_uppercat'] == '')
{
diff --git a/install/upgrade_1.3.1.php b/install/upgrade_1.3.1.php
index 371f65d8c..69257dc5c 100644
--- a/install/upgrade_1.3.1.php
+++ b/install/upgrade_1.3.1.php
@@ -42,7 +42,7 @@ $query = '
SELECT prefix_thumbnail, mail_webmaster
FROM '.PREFIX_TABLE.'config
;';
-$save = mysql_fetch_array(pwg_query($query));
+$save = mysql_fetch_assoc(pwg_query($query));
$queries = array(
"
@@ -344,7 +344,7 @@ SHOW INDEX
FROM '.PREFIX_TABLE.$table.'
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
if ($row['Key_name'] != 'PRIMARY')
{
@@ -536,7 +536,7 @@ SELECT DISTINCT(storage_category_id) AS unique_storage_category_id
FROM '.IMAGES_TABLE.'
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push($cat_ids, $row['unique_storage_category_id']);
}
@@ -561,7 +561,7 @@ SELECT id
WHERE status = \'private\'
;';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push($cat_ids, $row['id']);
}
diff --git a/install/upgrade_1.4.0.php b/install/upgrade_1.4.0.php
index 26eea0810..78ff1d5f7 100644
--- a/install/upgrade_1.4.0.php
+++ b/install/upgrade_1.4.0.php
@@ -42,7 +42,7 @@ SELECT value
FROM '.CONFIG_TABLE.'
WHERE param = \'prefix_thumbnail\'
;';
-list($prefix_thumbnail) = mysql_fetch_array(pwg_query($query));
+list($prefix_thumbnail) = mysql_fetch_row(pwg_query($query));
// delete obsolete configuration
$query = '
@@ -194,7 +194,7 @@ $datas = array();
list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
$row['user_id'] = $row['id'];
$row['registration_date'] = $dbnow;
diff --git a/install/upgrade_1.5.0.php b/install/upgrade_1.5.0.php
index 0d638d1e5..87f9a0c7c 100644
--- a/install/upgrade_1.5.0.php
+++ b/install/upgrade_1.5.0.php
@@ -79,7 +79,7 @@ SELECT id, keywords
WHERE keywords IS NOT NULL
;';
$result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
foreach(preg_split('/[,]+/', $row['keywords']) as $keyword)
{
@@ -351,7 +351,7 @@ $conf = $conf_save;
// Do I already have them in DB ?
$query = 'SELECT param FROM '.PREFIX_TABLE.'config';
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
unset( $params[ $row['param'] ] );
}
@@ -452,7 +452,7 @@ DESC '.PREFIX_TABLE.'users
$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
if (!in_array($row['Field'], $to_keep))
{
diff --git a/password.php b/password.php
index 47741cb14..05c42b07d 100644
--- a/password.php
+++ b/password.php
@@ -79,7 +79,7 @@ WHERE '
$error_on_mail = false;
$datas = array();
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
$new_password = generate_key(6);
diff --git a/picture.php b/picture.php
index 78f3f719f..d98fcfc21 100644
--- a/picture.php
+++ b/picture.php
@@ -57,7 +57,7 @@ SELECT id, file, level
str_replace(array('_','%'), array('/_','/%'), $page['image_file'] ).
'.%" ESCAPE "/" LIMIT 1';
}
- if ( ! ( $row = mysql_fetch_array(pwg_query($query)) ) )
+ if ( ! ( $row = mysql_fetch_assoc(pwg_query($query)) ) )
{// element does not exist
page_not_found( 'The requested image does not exist',
duplicate_index_url()
@@ -387,7 +387,7 @@ SELECT category_id,uppercats,commentable,global_rank
;';
$result = pwg_query($query);
$related_categories = array();
-while ($row = mysql_fetch_array($result))
+while ($row = mysql_fetch_assoc($result))
{
array_push($related_categories, $row);
}
@@ -767,7 +767,7 @@ SELECT COUNT(*) AS nb_fav
AND user_id = '.$user['id'].'
;';
$result = pwg_query($query);
- $row = mysql_fetch_array($result);
+ $row = mysql_fetch_assoc($result);
if ($row['nb_fav'] == 0)
{
diff --git a/search_rules.php b/search_rules.php
index c3977060d..fb2fd612b 100644
--- a/search_rules.php
+++ b/search_rules.php
@@ -135,7 +135,7 @@ SELECT id, uppercats, global_rank
$categories = array();
if (!empty($result))
{
- while ($row = mysql_fetch_array($result))
+ while ($row = mysql_fetch_assoc($result))
{
array_push($categories, $row);
}
diff --git a/upload.php b/upload.php
index d1cffa25d..f5ae78721 100644
--- a/upload.php
+++ b/upload.php
@@ -288,7 +288,7 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
$query.= ' where id = '.$_GET['waiting_id'];
$query.= ';';
$result= pwg_query( $query );
- $row = mysql_fetch_array( $result );
+ $row = mysql_fetch_assoc( $result );
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
$extension = get_extension( $_FILES['picture']['name'] );