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?
[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
?>
simple where have you got the $banner $url and $id variables from? I think you will need to use $row[1] $row[2] etc depending on how its stored in the DB.
[QUOTE=Sniper]
simple where have you got the $banner $url and $id variables from? I think you will need to use $row[1] $row[2] etc depending on how its stored in the DB.
[/QUOTE]
sorry..clarify that?
Like instead of using the unique $id, use the row number?? surely thats the same thing.
[php]<a href="?module=admin&action=manageaffiliates&approve=yes&id=$id">Approve[/php]
which displays fine, for each affiliate banner, there is a link saying “Approve”, and the link contains this, for example:
<?php
if($_GET[approve=yes&id] == $id) // right here..I don't know how to word it so it checks to see if approve was clicked, and what ID to approve it was. Hope this is making sense..
{
$sql = mysql_query("'UPDATE `affiliates` SET `approved` = '1' WHERE `id` = $id LIMIT 1'");
mysql_query($query);
echo("Approved!");
}
?>[/php]
this might work
[php]<?
if (@$approve== ‘yes’) {
$id = $_GET[‘id’];
$sql = mysql_query(“‘UPDATE affiliates SET approved = ‘1’ WHERE id = $id LIMIT 1’”);
mysql_query($query);
echo(“Approved!”);
}