View Single Post
Old 04-17-2005, 07:56 AM   #8 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,694
redhead is on a distinguished road
I just looked through the code, and if I were to make it I'd probably do it something like this, assuming GetICMSData() is returning the number instead of an array with the number.
PHP Code:
function CountDefUpdates () 

    
$newcount GetICMSData ("SELECT COUNT(*) FROM desktops WHERE status=\"installed\"",$link); 
    
UpdateICMS("UPDATE desktops SET status = \"dupend\" WHERE status = \"installed\"AND spy_policy_index = 2",$link); 

  
$file="count.txt"

  
$fp=fopen($file,"r+"); // make it read and write accessible 
  
$ret fscanf($fp"%[0-9]"$count);
  if(!
$ret)
    
$count 0;           // catch if the file is empty
  
fseek($fp0);          // rewind to start of file, to prepare for writing
  
fprintf($fp"%d"$count+$newcount);
  
fclose($fp); 

__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote