update edit database script help

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 19
Joined: Sun Nov 16, 2003 9:12 am

update edit database script help

Postby speedamp » Mon Dec 01, 2003 11:58 am

hello everybody,

I am attempting to create an edit/delete script, and here is what i have so far:




$sql="UPDATE directory SET club='$club',first='$first',last='$last',age='$age',sex='$sex',race='$race' WHERE run_id=$id";
echo"Thank you! Information updated.\n";
$sql="SELECT * FROM runner WHERE run_id = $id";
<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">
$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?



User avatar
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

global variables...

Postby ruturajv » Mon Dec 01, 2003 11:57 pm

Can you please check that you are using $_POST['varname'] or $_GET['varname']

when you are actually searching...


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests