dredge
04-29-2004, 12:48 PM
I am building an administration page with many functions for my site. So far i have gotten everything to work pretty well and then when i put this as part of it, i can not get it to work no matter what i try.
I put in several pieces of coding to see if i can check and see if it works along the way and it does. but it just will not edit the database. i included the "config.php" further up above this in my coding to connect to the database.
What am I doing wrong? Will someone pleae hel me out?
if ($view == 'affcheck') {
$result = mysql_query("select * from affiliate");
while($out = mysql_fetch_array($result)) {
print "<table style='border-bottom:1px solid #4F5D69;' border=0 width=90% align=center><tr>";
print "<td width=40%><b>$out[name]</b></td>";
print "<td width=40%><a href=$out[addy]>$out[addy]</a></td>";
print "<td align=right width=10%>";
if ($out[check]=='N') {
print "<a href=admin.php?action=acceptaff&id=$out[id]&set=Y><img border=0 src='/images/notcheck.jpg'></a></td>";
} else {
print "<a href=admin.php?action=checkaff&id=$out[id]&set=N><img border=0 src='/images/check.jpg'></a></td>";
}
print "</tr><tr>";
print "<td><img src='$out[banner]'></td><td colspan=3 bgcolor=#4F5D69>$out[description]</td>";
print "</tr></table>";
}
}
if ($action == 'acceptaff') {
$getit = mysql_query("select * from affiliate where id='$id'");
$changeit = mysql_fetch_array($getit);
print "$action | $changeit[id] | $changeit[check]<br><br>";
if ($changeit[check] == 'N') {
mysql_query("update affiliate set check=Y where id=$changeit[id]");
} else {
mysql_query("update affiliate set check=N where id=$changeit[id]");
}
$getitagain = mysql_query("select * from affiliate where id='$id'");
$changeitagain = mysql_fetch_array($getitagain);
print "Changed $changeitagain[name]`s check value to $changeitagain[check]";
}
I put in several pieces of coding to see if i can check and see if it works along the way and it does. but it just will not edit the database. i included the "config.php" further up above this in my coding to connect to the database.
What am I doing wrong? Will someone pleae hel me out?
if ($view == 'affcheck') {
$result = mysql_query("select * from affiliate");
while($out = mysql_fetch_array($result)) {
print "<table style='border-bottom:1px solid #4F5D69;' border=0 width=90% align=center><tr>";
print "<td width=40%><b>$out[name]</b></td>";
print "<td width=40%><a href=$out[addy]>$out[addy]</a></td>";
print "<td align=right width=10%>";
if ($out[check]=='N') {
print "<a href=admin.php?action=acceptaff&id=$out[id]&set=Y><img border=0 src='/images/notcheck.jpg'></a></td>";
} else {
print "<a href=admin.php?action=checkaff&id=$out[id]&set=N><img border=0 src='/images/check.jpg'></a></td>";
}
print "</tr><tr>";
print "<td><img src='$out[banner]'></td><td colspan=3 bgcolor=#4F5D69>$out[description]</td>";
print "</tr></table>";
}
}
if ($action == 'acceptaff') {
$getit = mysql_query("select * from affiliate where id='$id'");
$changeit = mysql_fetch_array($getit);
print "$action | $changeit[id] | $changeit[check]<br><br>";
if ($changeit[check] == 'N') {
mysql_query("update affiliate set check=Y where id=$changeit[id]");
} else {
mysql_query("update affiliate set check=N where id=$changeit[id]");
}
$getitagain = mysql_query("select * from affiliate where id='$id'");
$changeitagain = mysql_fetch_array($getitagain);
print "Changed $changeitagain[name]`s check value to $changeitagain[check]";
}