A
Anonymous
Guest
hello everybody,
I am attempting to create an edit/delete script, and here is what i have so far:
----------------------------------------------------------------------------------
<?php
$db=mysql_connect();
mysql_select_db();
if($id){
if($submit){
$sql="UPDATE directory SET club='$club',first='$first',last='$last',age='$age',sex='$sex',race='$race' WHERE run_id=$id";
$result=mysql_query($sql);
echo"Thank you! Information updated.\n";
}else{
$sql="SELECT * FROM runner WHERE run_id = $id";
$result=mysql_query($sql);
$myrow=mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="run_id" value="<?php echo $myrow["run_id"]?>">
Club:<input type="text" name="club" value="<?php echo $myrow["club"]?>"><br>
First:<input type="text" name="first" value="<?php echo $myrow["first"]?>"><br>
Last:<input type="text" name="last" value="<?php echo $myrow["last"]?>"><br>
Age:<input type="text" name="age" value="<?php echo $myrow["age"]?>"><br>
Sex:<input type="text" name="sex" value="<?php echo $myrow["sex"]?>"><br>
Race:<input type="text" name="race" value="<?php echo $myrow["race"]?>"><br>
<input type="Submit" name="submit" value="Enter Information">
</form>
<?php
}
}else{
$query = "SELECT * FROM runner";
$result = mysql_query($query);
while ($myrow = mysql_fetch_array($result)){
printf("<a href=\"%s?id=%s\">%s</a><br>\n", $PHP_SELF, $myrow["run_id"], $myrow["first"], $myrow["last"]);
}
}
?>
--------------------------------------------------------------------------------
Right now it's not updating properly....what am i doing wrong?
1) how do i get this to update all fields pertaining to $email (verification field)?
2) How could i add a delete option next to the name to fully delete?
Thanks,
-Michael
I am attempting to create an edit/delete script, and here is what i have so far:
----------------------------------------------------------------------------------
<?php
$db=mysql_connect();
mysql_select_db();
if($id){
if($submit){
$sql="UPDATE directory SET club='$club',first='$first',last='$last',age='$age',sex='$sex',race='$race' WHERE run_id=$id";
$result=mysql_query($sql);
echo"Thank you! Information updated.\n";
}else{
$sql="SELECT * FROM runner WHERE run_id = $id";
$result=mysql_query($sql);
$myrow=mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="run_id" value="<?php echo $myrow["run_id"]?>">
Club:<input type="text" name="club" value="<?php echo $myrow["club"]?>"><br>
First:<input type="text" name="first" value="<?php echo $myrow["first"]?>"><br>
Last:<input type="text" name="last" value="<?php echo $myrow["last"]?>"><br>
Age:<input type="text" name="age" value="<?php echo $myrow["age"]?>"><br>
Sex:<input type="text" name="sex" value="<?php echo $myrow["sex"]?>"><br>
Race:<input type="text" name="race" value="<?php echo $myrow["race"]?>"><br>
<input type="Submit" name="submit" value="Enter Information">
</form>
<?php
}
}else{
$query = "SELECT * FROM runner";
$result = mysql_query($query);
while ($myrow = mysql_fetch_array($result)){
printf("<a href=\"%s?id=%s\">%s</a><br>\n", $PHP_SELF, $myrow["run_id"], $myrow["first"], $myrow["last"]);
}
}
?>
--------------------------------------------------------------------------------
Right now it's not updating properly....what am i doing wrong?
1) how do i get this to update all fields pertaining to $email (verification field)?
2) How could i add a delete option next to the name to fully delete?
Thanks,
-Michael