I have a web page that has been working quite well. I decided to move the section that updates the database to a function. Now It seems to work but does not. It does return a value of True or 1.
I put the following where I usually do the updating:
$result = UpdateData($principalscode,$principalscompanyname,$principalsdescription,$principalsdescription,$principalslogofilename,$code1,$code2,$datemodified,$modifiedby,$active);
I then added a function to do the updating at the top of my program:
<title>Principals Data Base</title>
<?Php
function UpdateData($principalscode,$principalscompanyname,$principalsdescription,$principalsdescription,$principalslogofilename,$code1,$code2,$datemodified,$modifiedby,$active){
$principalscode = strtoupper($principalscode);
$description = addslashes($principalsdescription);
$today = getdate();
$day = $today['year']."-".$today['mon']."-".$today['mday'];
//echo "day=" . $day;
$result = mysql_query("update principals
set principalscode = '$principalscode' ,
principalscompanyname = '$principalscompanyname' ,
principalsdescription = '$principalsdescription',
principalswwwaddress = '$principalswwwaddress',
principalslogofilename = '$principalslogofilename',
code1 = '$code1',
code2 = '$code2',
datemodified = '$day'
where id ='".$id."'");
echo "result=" . $result;
return($result);
};
?>
Like I say it returns True but does not do the update. Any suggestions? Gotta be simple.
THX 🙂