Ignore:
Timestamp:
Mar 17, 2013, 3:55:39 PM (11 years ago)
Author:
mistic100
Message:

replace mysql_* by pwg_db_* and correct errors inherited by mysql return values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/include/evntcats_main_funcs.inc.php

    r10052 r21652  
    7777 */
    7878function ec_image_exists($cat, $img) {
    79   return (mysql_fetch_row(pwg_query("
     79  $r = pwg_query("
    8080    SELECT *
    8181    FROM `".IMAGE_CATEGORY_TABLE."`
    8282    WHERE `category_id` = ".$cat."
    8383     AND `image_id` = ".$img
    84   )) !== false);
     84  );
     85  return (bool)pwg_num_rows($r);
    8586}
    8687
     
    207208  if (defined('ADD_PAGES_TABLE')) {
    208209    $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`;");
    209     while ($r = mysql_fetch_array($res)) {
     210    while ($r = pwg_db_fetch_assoc($res)) {
    210211      $a = (is_in($r['title'], '/user_id=')) ?
    211212       explode('/user_id=' , $r['title']) : array($r['title']);
     
    281282    ORDER BY `id`
    282283  ");
    283   while ($r = mysql_fetch_assoc($q))
     284  while ($r = pwg_db_fetch_assoc($q))
    284285   $ec_lists['ec_table'][intval($r['id'])] = $r;
    285286 
     
    395396  // certain group (in groups, level (friends, family, contacts),
    396397  // or user status (generic))
    397   $types_entry_exists = (($t = mysql_fetch_row(pwg_query("
     398  $r = pwg_query("
    398399    SELECT `arg2`
    399400    FROM `".EVNTCATS_TABLE."`
     
    402403      AND `arg2` IS NOT NULL
    403404    LIMIT 1;
    404   "))) !== false);
    405   $ec_lists['types_granted'] = ($types_entry_exists) ? $t[0] : 0;
     405  ");
     406  if (pwg_db_num_rows($r)) {
     407    $types_entry_exists = true;
     408    list($ec_lists['types_granted']) = pwg_db_fetch_row($r);
     409  }
     410  else {
     411    $types_entry_exists = false;
     412    $ec_lists['types_granted'] = 0;
     413  }
    406414 
    407415  return $types_entry_exists;
     
    495503          AND `user_id` > 2;
    496504      ");
    497       while ($row = mysql_fetch_array($result)) {
     505      while ($row = pwg_db_fetch_assoc($result)) {
    498506        if (!isset($user_granted_from_type[$row['level']])) {
    499507          $user_granted_from_type[$row['level']] = array();
     
    534542        AND `user_id` > 2;
    535543    ");
    536     while ($row = mysql_fetch_array($result)) {
     544    while ($row = pwg_db_fetch_assoc($result)) {
    537545      if (!isset($granted_groups[$row['group_id']])) {
    538546        $granted_groups[$row['group_id']] = array();
Note: See TracChangeset for help on using the changeset viewer.