Man this php stuff is a bitch...seems like it works, then it doesn't.
Ok I gave up, for now, on the whole displaying banners in rows idea, will come back to that.
I feel that I should have to approve submitted banners before they appear, so I've created an extra field in my database - approved, with a default of 0.
My affiliate page is set to display only those with an approved state of 1, and this works fine.
My affiliate admin page, is set to display those that aren't approved, with two links - "Approve" or "Delete."
now my code, which I think is correct, doesn't work. tres surprise.
however, the query success message is echoed..just nothing happens.
Thoughts?
Ok I gave up, for now, on the whole displaying banners in rows idea, will come back to that.
I feel that I should have to approve submitted banners before they appear, so I've created an extra field in my database - approved, with a default of 0.
My affiliate page is set to display only those with an approved state of 1, and this works fine.
My affiliate admin page, is set to display those that aren't approved, with two links - "Approve" or "Delete."
now my code, which I think is correct, doesn't work. tres surprise.
however, the query success message is echoed..just nothing happens.
Thoughts?
PHP:
<?php
$query="SELECT * from affiliates where approved = 0";
$result=mysql_query($query) or die ("Couldn't execute query: $query." . mysql_error());
while($row=mysql_fetch_array($result))
{
extract($row); // extract row values
?>
<table width="300" cellpadding="2" cellspacing="5" border="1" bordercolor="#700909" style="border-collapse:collapse ">
<tr><td width="100">
<div align="center"><img src="<?php echo $banner; ?>" border="0">
</div></td>
<td>
<b>Site:</b> <?php echo "<a href=\"$url\" target=\"_blank\">$url"?><br>
<br>
<center>
<a href="?module=admin&action=manageaffiliates&approve=yes&id=<?php echo $id; ?>">Approve</a> //this is the bit i think is wrong...
</center>
</td>
</tr></table>
<br>
<?php
} // end of while
if($_GET[approve] == yes) //or this.
{
$sql = mysql_query("'UPDATE `affiliates` SET `approved` = '1' WHERE `id` = $id LIMIT 1'");
echo("Approved!");
}
?>