Changeset 4265 for trunk/include


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

Location:
trunk/include
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_monthly.class.php

    r3282 r4265  
    232232  $result = pwg_query($query);
    233233  $items=array();
    234   while ($row = mysql_fetch_array($result))
     234  while ($row = mysql_fetch_assoc($result))
    235235  {
    236236    $y = substr($row['period'], 0, 4);
     
    284284  $result = pwg_query($query);
    285285  $items=array();
    286   while ($row = mysql_fetch_array($result))
     286  while ($row = mysql_fetch_assoc($result))
    287287  {
    288288    $m = (int)substr($row['period'], 0, 2);
     
    334334  $items=array();
    335335  $result = pwg_query($query);
    336   while ($row = mysql_fetch_array($result))
     336  while ($row = mysql_fetch_assoc($result))
    337337  {
    338338    $d = (int)$row['period'];
  • trunk/include/category_cats.inc.php

    r3282 r4265  
    179179;';
    180180    $result = pwg_query($query);
    181     while ($row = mysql_fetch_array($result))
     181    while ($row = mysql_fetch_assoc($result))
    182182    {
    183183      $dates_of_category[ $row['category_id'] ] = array(
  • trunk/include/functions.inc.php

    r3750 r4265  
    4545  // columns are 'Field', 'Type'
    4646  $result = pwg_query('desc '.$table);
    47   while ($row = mysql_fetch_array($result))
     47  while ($row = mysql_fetch_assoc($result))
    4848  {
    4949    // we are only interested in the the field given in parameter for the
     
    936936
    937937  $result = pwg_query($query);
    938   while ($row = mysql_fetch_array($result))
     938  while ($row = mysql_fetch_assoc($result))
    939939  {
    940940    array_push($array, $row[$fieldname]);
     
    11221122  WHERE '.$conf['user_fields']['id'].' = '.$conf['webmaster_id'].'
    11231123;';
    1124   list($email) = mysql_fetch_array(pwg_query($query));
     1124  list($email) = mysql_fetch_row(pwg_query($query));
    11251125
    11261126  return $email;
     
    11481148  }
    11491149
    1150   while ($row = mysql_fetch_array($result))
     1150  while ($row = mysql_fetch_assoc($result))
    11511151  {
    11521152    $conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : '';
     
    11931193
    11941194  $result = pwg_query($query);
    1195   while ($row = mysql_fetch_array($result))
     1195  while ($row = mysql_fetch_assoc($result))
    11961196  {
    11971197    $array[ $row[$keyname] ] = $row[$valuename];
     
    15851585    // Use MySql date in order to standardize all recent "actions/queries"
    15861586    list($cache['get_icon']['sql_recent_date']) =
    1587       mysql_fetch_array(pwg_query('select SUBDATE(
     1587      mysql_fetch_row(pwg_query('select SUBDATE(
    15881588      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
    15891589  }
  • trunk/include/functions_category.inc.php

    r3282 r4265  
    241241    $query.= ' FROM '.CATEGORIES_TABLE.' WHERE id = '.$category_id;
    242242    $query.= ';';
    243     $row = mysql_fetch_array( pwg_query( $query ) );
     243    $row = mysql_fetch_assoc( pwg_query( $query ) );
    244244    $uppercats = $row['uppercats'];
    245245  }
     
    252252  $query.= ';';
    253253  $result = pwg_query( $query );
    254   while( $row = mysql_fetch_array( $result ) )
     254  while( $row = mysql_fetch_assoc( $result ) )
    255255  {
    256256    $database_dirs[$row['id']] = $row['dir'];
     
    276276    AND c.id = '.$category_id.'
    277277;';
    278   $row = mysql_fetch_array(pwg_query($query));
     278  $row = mysql_fetch_assoc(pwg_query($query));
    279279  return $row['galleries_url'];
    280280}
     
    385385
    386386  $subcats = array();
    387   while ($row = mysql_fetch_array($result))
     387  while ($row = mysql_fetch_assoc($result))
    388388  {
    389389    array_push($subcats, $row['id']);
  • trunk/include/functions_mail.inc.php

    r3938 r4265  
    352352  if (!empty($datas))
    353353  {
    354     while ($admin = mysql_fetch_array($datas))
     354    while ($admin = mysql_fetch_assoc($datas))
    355355    {
    356356      if (!empty($admin['mail_address']))
     
    451451  {
    452452    $list = array();
    453     while ($row = mysql_fetch_array($result))
     453    while ($row = mysql_fetch_assoc($result))
    454454    {
    455455      $row['template_theme'] = $row['template'];
     
    480480      {
    481481        $Bcc = array();
    482         while ($row = mysql_fetch_array($result))
     482        while ($row = mysql_fetch_assoc($result))
    483483        {
    484484          if (!empty($row['mail_address']))
  • trunk/include/functions_notification.inc.php

    r3282 r4265  
    146146    $query = 'SELECT count(distinct '.$field_id.') as CountId
    147147'.$query;
    148     list($count) = mysql_fetch_array(pwg_query($query));
     148    list($count) = mysql_fetch_row(pwg_query($query));
    149149    return $count;
    150150
     
    179179    $infos = array();
    180180
    181     while ($row = mysql_fetch_array($result))
     181    while ($row = mysql_fetch_assoc($result))
    182182    {
    183183      array_push($infos, $row);
  • trunk/include/functions_plugins.inc.php

    r3282 r4265  
    239239  $result = pwg_query($query);
    240240  $plugins = array();
    241   while ($row = mysql_fetch_array($result))
     241  while ($row = mysql_fetch_assoc($result))
    242242  {
    243243    array_push($plugins, $row);
  • trunk/include/functions_search.inc.php

    r4261 r4265  
    459459  $by_weights=array();
    460460  $result = pwg_query($query);
    461   while ($row = mysql_fetch_array($result))
     461  while ($row = mysql_fetch_assoc($result))
    462462  { // weight is important when sorting images by relevance
    463463    if ($row['weight'])
  • trunk/include/functions_user.inc.php

    r3747 r4265  
    5959'.(is_numeric($user_id) ? 'and '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').'
    6060;';
    61     list($count) = mysql_fetch_array(pwg_query($query));
     61    list($count) = mysql_fetch_row(pwg_query($query));
    6262    if ($count != 0)
    6363    {
     
    111111  FROM '.USERS_TABLE.'
    112112;';
    113     list($next_id) = mysql_fetch_array(pwg_query($query));
     113    list($next_id) = mysql_fetch_row(pwg_query($query));
    114114
    115115    $insert =
     
    135135
    136136      $inserts = array();
    137       while ($row = mysql_fetch_array($result))
     137      while ($row = mysql_fetch_assoc($result))
    138138      {
    139139        array_push
     
    250250  WHERE '.$conf['user_fields']['id'].' = \''.$user_id.'\'';
    251251
    252   $row = mysql_fetch_array(pwg_query($query));
     252  $row = mysql_fetch_assoc(pwg_query($query));
    253253
    254254  while (true)
     
    270270  }
    271271
    272   $row = array_merge($row, mysql_fetch_array($result));
     272  $row = array_merge($row, mysql_fetch_assoc($result));
    273273
    274274  foreach ($row as $key => $value)
     
    325325  WHERE category_id NOT IN ('.$userdata['forbidden_categories'].')
    326326    AND image_id '.$userdata['image_access_type'].' ('.$userdata['image_access_list'].')';
    327       list($userdata['nb_total_images']) = mysql_fetch_array(pwg_query($query));
     327      list($userdata['nb_total_images']) = mysql_fetch_row(pwg_query($query));
    328328
    329329
     
    429429  $result = pwg_query($query);
    430430  $authorizeds = array();
    431   while ($row = mysql_fetch_array($result))
     431  while ($row = mysql_fetch_assoc($result))
    432432  {
    433433    array_push($authorizeds, $row['image_id']);
     
    441441  $result = pwg_query($query);
    442442  $favorites = array();
    443   while ($row = mysql_fetch_array($result))
     443  while ($row = mysql_fetch_assoc($result))
    444444  {
    445445    array_push($favorites, $row['image_id']);
     
    482482;';
    483483  $result = pwg_query($query);
    484   while ($row = mysql_fetch_array($result))
     484  while ($row = mysql_fetch_assoc($result))
    485485  {
    486486    array_push($private_array, $row['id']);
     
    524524;';
    525525    $result = pwg_query($query);
    526     while ($row = mysql_fetch_array($result))
     526    while ($row = mysql_fetch_assoc($result))
    527527    {
    528528      array_push($forbidden_array, $row['id']);
  • trunk/include/picture_comment.inc.php

    r3488 r4265  
    9494  FROM '.COMMENTS_TABLE.'
    9595  WHERE image_id='.$page['image_id']." AND validated = 'true'";
    96   $row = mysql_fetch_array( pwg_query( $query ) );
     96  $row = mysql_fetch_assoc( pwg_query( $query ) );
    9797
    9898  // navigation bar creation
     
    141141    $result = pwg_query( $query );
    142142
    143     while ($row = mysql_fetch_array($result))
     143    while ($row = mysql_fetch_assoc($result))
    144144    {
    145145      if (!empty($row['author']))
  • trunk/include/picture_rate.inc.php

    r3282 r4265  
    3838  WHERE element_id = '.$picture['current']['id'].'
    3939;';
    40     $row = mysql_fetch_array(pwg_query($query));
     40    $row = mysql_fetch_assoc(pwg_query($query));
    4141  }
    4242  else
     
    7070      if (mysql_num_rows($result) > 0)
    7171      {
    72         $row = mysql_fetch_array($result);
     72        $row = mysql_fetch_assoc($result);
    7373        $user_rate = $row['rate'];
    7474      }
Note: See TracChangeset for help on using the changeset viewer.