From 1040cae2104259fdec8543e0a41ac63cbe24c69c Mon Sep 17 00:00:00 2001 From: nikrou Date: Sun, 15 Nov 2009 12:26:09 +0000 Subject: 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 --- install/db/12-database.php | 2 +- install/db/18-database.php | 2 +- install/db/19-database.php | 2 +- install/db/20-database.php | 2 +- install/db/65-database.php | 4 ++-- install/db/8-database.php | 2 +- install/db/9-database.php | 2 +- install/upgrade_1.3.0.php | 2 +- install/upgrade_1.3.1.php | 8 ++++---- install/upgrade_1.4.0.php | 4 ++-- install/upgrade_1.5.0.php | 6 +++--- 11 files changed, 18 insertions(+), 18 deletions(-) (limited to 'install') 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)) { -- cgit v1.2.3