Changeset 1313

Show
Ignore:
Timestamp:
02/28/06 07:21:18 (3 years ago)
Author:
mbonetti
Message:

Fix for #356. Thanks for the patch, Adam.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/cls/config.php

    r1309 r1313  
    145145            } 
    146146            $val = rss_real_escape_string($val); 
    147             rss_query('insert into ' .getTable('properties')  
    148             .'(fk_ref_object_id, proptype, property, value) values (' 
    149             ."'$ref_obj','$type','$prop','$val'" 
    150             .')' 
    151             // I hope this is ANSI! 
    152             . " ON DUPLICATE KEY UPDATE value='$val'" 
    153             ); 
     147 
     148           $res = rss_query('SELECT count(fk_ref_object_id) FROM '  
     149           .getTable('properties') 
     150           ." WHERE fk_ref_object_id = '$ref_obj' AND proptype = '$type'" 
     151           ." AND property = '$prop'"); 
     152            list ($cnt_rows) = rss_fetch_row($res); 
     153 
     154            if ($cnt_rows) { 
     155                   rss_query('UPDATE '  
     156                   .getTable('properties')  
     157                   ." SET value = '$val' WHERE fk_ref_object_id = '$ref_obj' AND proptype = '$type'" 
     158                   ." AND property = '$prop'"); 
     159            } else { 
     160                   rss_query('insert into '  
     161                   .getTable('properties')  
     162                   .'(fk_ref_object_id, proptype, property, value) values (' 
     163                   ."'$ref_obj','$type','$prop','$val'" 
     164                   .')'); 
     165            } 
     166             
     167             
    154168            $this -> _populateProperties(); 
    155169            rss_invalidate_cache();