mental constipation - trying to work in a conditional stmt
Posted: Tue Oct 22, 2002 2:51 pm
Hi all. I'm stuck.
I need users(retailers) to only be able to sign up for a position if there is not a user(retailers) detail already in the adjacent slot. They sign up by clicking on the slot name (platinum, gold, silver, etc.) That link when clicked tells a switch on index.php that it's a case of "update" (which is defined on the index.php), gives user a page to input data (edit.php), and updates the record as specified in update.php. I've tried to prevent the update of the record by using an if my $retailer is not null statement to tell it not to update unless there is no value yet. I've tried putting the conditional in the index.php, here:
that broke it. tried here in update.php:
but then it zeroed other values in that row, and gave me 'headers already sent from the index.php' error.
The only other place I can think of putting it is the list page:
But how? Is this the right place and is this even the right way to do this?
here's a link in case I was too roundabout or otherwise unclear:
http://www.mc2ads.com/liltestretail/ret ... /index.php
Ultimately - I would like to disable the link if someone has already signed up.
I need users(retailers) to only be able to sign up for a position if there is not a user(retailers) detail already in the adjacent slot. They sign up by clicking on the slot name (platinum, gold, silver, etc.) That link when clicked tells a switch on index.php that it's a case of "update" (which is defined on the index.php), gives user a page to input data (edit.php), and updates the record as specified in update.php. I've tried to prevent the update of the record by using an if my $retailer is not null statement to tell it not to update unless there is no value yet. I've tried putting the conditional in the index.php, here:
Code: Select all
case "update":
require("update.php"); // update the db where rid=$rid
header("Location: index.php"); // go to listing
break;
default:Code: Select all
<?
mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_name);
$sql = "UPDATE $db_table SET retailer='".$HTTP_POST_VARSї'retailer']."' WHERE rid=".$HTTP_POST_VARSї'rid'];
$result = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
?>The only other place I can think of putting it is the list page:
Code: Select all
<?php
mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_name);
$result = mysql_query("select * from $db_table");
while($r=mysql_fetch_array($result))
{
?>
<tr>
<td><?php print $rї'rid']; ?></td>
<td><?php print $rї'week']; ?></td>
<td><?php print $rї'week_ending']; ?></td>
<td><?php print $rї'theme']; ?></td>
<td><a href="index.php?todo=edit&editrid=<?php print $rї'rid']; ?>"><?php print $rї'avail_slot']; ?></td>
<td><?php print $rї'retailer']; ?></td>
</tr>
<?php
}
?>here's a link in case I was too roundabout or otherwise unclear:
http://www.mc2ads.com/liltestretail/ret ... /index.php
Ultimately - I would like to disable the link if someone has already signed up.