Taylor_1978
07-11-2005, 05:57 PM
Quick question which I'm sure has a quick answer :)
Here is my code:
// ADMIN LOG - LIST CHANGES
$log_entry = array("alias","email","matcheswon","matcheslost","tourneyswon","tourneyslost","tourneysentered","tourneys_1st","tourneys_hosted");
foreach($log_entry as $recall) {
if ($_POST[$recall] != $uinfo[$recall]) {
admin_log("change $recall",$uinfo[id],$_COOKIE[a_uid],"Change $recall from $uinfo[$recall] to $_POST[$recall]",$date);
}
}
Okay - problem is.. once the foreach reaches "matcheswon", ",matcheslost" etc... I want this it to appear as "Matches Won" and "Matches Lost" after the word Change.
The solution I have is this.. but I'm sure there is a better way:
// ADMIN LOG - LIST CHANGES
$log_entry = array("alias","email","matcheswon","matcheslost","tourneyswon","tourneyslost","tourneysentered","tourneys_1st","tourneys_hosted");
foreach($log_entry as $recall) {
if ($recall == "matcheswon") {
$sub = "Matches Won";
}
if ($_POST[$recall] != $uinfo[$recall]) {
admin_log("change $recall",$uinfo[id],$_COOKIE[a_uid],"Change $sub from $uinfo[$recall] to $_POST[$recall]",$date);
}
}
Doing it this way would mean I'd have to put in this secion:
if ($recall == "matcheswon") {
$sub = "Matches Won";
}
Once each, for "matcheswon", "matcheslost", "tourneyswon", "tourneyslost", "tourneysentered", "tourneys_1st", "tourneys_hosted"
Can anyone suggest a better way?
Thanks in advance! :thumbsup:
Here is my code:
// ADMIN LOG - LIST CHANGES
$log_entry = array("alias","email","matcheswon","matcheslost","tourneyswon","tourneyslost","tourneysentered","tourneys_1st","tourneys_hosted");
foreach($log_entry as $recall) {
if ($_POST[$recall] != $uinfo[$recall]) {
admin_log("change $recall",$uinfo[id],$_COOKIE[a_uid],"Change $recall from $uinfo[$recall] to $_POST[$recall]",$date);
}
}
Okay - problem is.. once the foreach reaches "matcheswon", ",matcheslost" etc... I want this it to appear as "Matches Won" and "Matches Lost" after the word Change.
The solution I have is this.. but I'm sure there is a better way:
// ADMIN LOG - LIST CHANGES
$log_entry = array("alias","email","matcheswon","matcheslost","tourneyswon","tourneyslost","tourneysentered","tourneys_1st","tourneys_hosted");
foreach($log_entry as $recall) {
if ($recall == "matcheswon") {
$sub = "Matches Won";
}
if ($_POST[$recall] != $uinfo[$recall]) {
admin_log("change $recall",$uinfo[id],$_COOKIE[a_uid],"Change $sub from $uinfo[$recall] to $_POST[$recall]",$date);
}
}
Doing it this way would mean I'd have to put in this secion:
if ($recall == "matcheswon") {
$sub = "Matches Won";
}
Once each, for "matcheswon", "matcheslost", "tourneyswon", "tourneyslost", "tourneysentered", "tourneys_1st", "tourneys_hosted"
Can anyone suggest a better way?
Thanks in advance! :thumbsup: