<?PHP

#
#   FILE:  SPT--SavedSearchComplete.php
#
#   FUNCTIONS PROVIDED:
#       (none)
#
#   FUNCTIONS EXPECTED:
#       (none)
#
#   FORM FIELDS EXPECTED:
#       (none)
#
#   Part of the Scout Portal Toolkit
#   Copyright 2004 Internet Scout Project
#   http://scout.cs.wisc.edu
#

$DB1 = new SPTDatabase();
$UserId = $User->Get("UserId"); 

$SearchId = NULL;
$Frequency = NULL;

$Query = "Select * from UserSearch where UserId = $UserId ".
                 "Order by SearchName";
$DB->Query($Query);
 
$Index=0;
while ($Entry = $DB->FetchRow())
{
    if (isset($_POST["F_SearchId_$Index"]))
        $SearchId = $_POST["F_SearchId_$Index"];

    if (isset($_POST["F_Frequency_$Index"]))
        $Frequency = $_POST["F_Frequency_$Index"];
        
    if ($SearchId)
    {
        $Query = "Update UserSearch set Frequency = \"$Frequency\" ".
            "WHERE UserId = $UserId AND SearchId = $SearchId";
        $DB1->Query($Query);
        $Index++;
    }
}
    
$AF->SetJumpToPage("SavedSearch");
 
?>
