This topic is locked

edit

2/25/2008 7:44:42 AM
PHPRunner General questions
G
garethp authorDevClub member

Hi another problem...
I have a table part with fields partid, description, archive
When the users clicks edit for a particular part if archive = 1 for that record i would like a message shown "you can not edit this part" and then redirect back to the original page part_list.php.
If archive is not equal to 1 I would like the user to be able to edit the record.
Hope someone can help - sorry I am not very good at coding events!

J
Jane 2/26/2008

Hi,
here is a sample:

global $conn,$strTableName;

if ($_REQUEST["editid1"])

{

$str = "select * from ".$strTableName." where partid=".$_REQUEST["editid1"];

$rs =db_query($str,$conn);

if ($data = db_fetch_array($rs))

if ($data["archive"]==1)

{

header("Location: tablename_list.php");

exit();

}

}

G
garethp authorDevClub member 2/28/2008

Fantastic - just the job!!
Thanks for the excellent support provided.