Ignore:
Timestamp:
Nov 15, 2009, 1:26:09 PM (14 years ago)
Author:
nikrou
Message:

Feature 1241 resolved. replace mysql_fetch_array by mysql_fetch_assoc for small php code improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r3657 r4265  
    3737  $result = pwg_query($query);
    3838  $category_ids = array();
    39   while ($row = mysql_fetch_array($result))
     39  while ($row = mysql_fetch_assoc($result))
    4040  {
    4141    array_push($category_ids, $row['id']);
     
    7878  $result = pwg_query($query);
    7979  $element_ids = array();
    80   while ($row = mysql_fetch_array($result))
     80  while ($row = mysql_fetch_assoc($result))
    8181  {
    8282    array_push($element_ids, $row['id']);
     
    545545    $columns = array();
    546546    $all_fields = array_merge($dbfields['primary'], $dbfields['update']);
    547     while ($row = mysql_fetch_array($result))
     547    while ($row = mysql_fetch_assoc($result))
    548548    {
    549549      if (in_array($row['Field'], $all_fields))
     
    631631
    632632  $result = pwg_query($query);
    633   while ($row = mysql_fetch_array($result))
     633  while ($row = mysql_fetch_assoc($result))
    634634  {
    635635    if ($row['id_uppercat'] != $current_uppercat)
     
    777777;';
    778778  $result = pwg_query($query);
    779   while ($row = mysql_fetch_array($result))
     779  while ($row = mysql_fetch_assoc($result))
    780780  {
    781781    $uppercats = array_merge($uppercats,
     
    804804  LIMIT 0,1
    805805;';
    806     list($representative) = mysql_fetch_array(pwg_query($query));
     806    list($representative) = mysql_fetch_row(pwg_query($query));
    807807
    808808    array_push(
     
    864864;';
    865865  $result = pwg_query($query);
    866   while ($row = mysql_fetch_array($result))
     866  while ($row = mysql_fetch_assoc($result))
    867867  {
    868868    array_push($categories, $row);
     
    11401140  $datas = array();
    11411141
    1142   while ($row = mysql_fetch_array($result))
     1142  while ($row = mysql_fetch_assoc($result))
    11431143  {
    11441144    array_push(
     
    12071207;';
    12081208  $result = pwg_query($query);
    1209   while ($row = mysql_fetch_array($result))
     1209  while ($row = mysql_fetch_assoc($result))
    12101210  {
    12111211    $categories[$row['id']] =
     
    13561356  WHERE id_uppercat '.(is_numeric($parent_id) ? '= '.$parent_id : 'IS NULL').'
    13571357;';
    1358   list($current_rank) = mysql_fetch_array(pwg_query($query));
     1358  list($current_rank) = mysql_fetch_row(pwg_query($query));
    13591359
    13601360  $insert = array(
     
    13721372  WHERE id = '.$parent_id.'
    13731373;';
    1374     $parent = mysql_fetch_array(pwg_query($query));
    1375 
    1376     $insert{'id_uppercat'} = $parent{'id'};
    1377     $insert{'global_rank'} = $parent{'global_rank'}.'.'.$insert{'rank'};
     1374    $parent = mysql_fetch_assoc(pwg_query($query));
     1375
     1376    $insert['id_uppercat'] = $parent['id'];
     1377    $insert['global_rank'] = $parent['global_rank'].'.'.$insert['rank'];
    13781378
    13791379    // at creation, must a category be visible or not ? Warning : if the
     
    13821382    if ('false' == $parent['visible'])
    13831383    {
    1384       $insert{'visible'} = 'false';
     1384      $insert['visible'] = 'false';
    13851385    }
    13861386    else
    13871387    {
    1388       $insert{'visible'} = boolean_to_string($conf['newcat_default_visible']);
     1388      $insert['visible'] = boolean_to_string($conf['newcat_default_visible']);
    13891389    }
    13901390
     
    13941394    if ('private' == $parent['status'])
    13951395    {
    1396       $insert{'status'} = 'private';
     1396      $insert['status'] = 'private';
    13971397    }
    13981398    else
    13991399    {
    1400       $insert{'status'} = $conf['newcat_default_status'];
     1400      $insert['status'] = $conf['newcat_default_status'];
    14011401    }
    14021402  }
    14031403  else
    14041404  {
    1405     $insert{'visible'} = boolean_to_string($conf['newcat_default_visible']);
    1406     $insert{'status'} = $conf['newcat_default_status'];
    1407     $insert{'global_rank'} = $insert{'rank'};
     1405    $insert['visible'] = boolean_to_string($conf['newcat_default_visible']);
     1406    $insert['status'] = $conf['newcat_default_status'];
     1407    $insert['global_rank'] = $insert['rank'];
    14081408  }
    14091409
     
    16101610  $query = 'SHOW TABLES LIKE \''.$prefixeTable.'%\'';
    16111611  $result = pwg_query($query);
    1612   while ($row = mysql_fetch_array($result))
     1612  while ($row = mysql_fetch_assoc($result))
    16131613  {
    16141614    array_push($all_tables, $row[0]);
     
    16261626    $query = 'DESC '.$table_name.';';
    16271627    $result = pwg_query($query);
    1628     while ($row = mysql_fetch_array($result))
     1628    while ($row = mysql_fetch_assoc($result))
    16291629    {
    16301630      if ($row['Key'] == 'PRI')
Note: See TracChangeset for help on using the changeset viewer.