here is the code for the edit record function you asked me to send.
hope it makes sense to you!!
function edit_record()
{
global $default_dbname, $cust_tablename;
global $custid, $new_custid, $custid, $firstname, $custpassword;
global $title, $email, $registerdate;
if(empty($custid)) error_message('Empty Customer ID!');
$link_id = db_connect($default_dbname);
if(!$link_id) error_message(sql_error());
$field_str = '';
if($custid != $new_custid) $field_str = " custid = '$new_custid', ";
if(!empty($custpassword))
{
$field_str .= " custpassword = password('$custpassword'), ";
}
$field_str .= " firstname = '$firstname', ";
$field_str .= " title = '$title', ";
$field_str .= " email = '$email', ";
$field_str .= " registerdate = '$registerdate', ";
$query = "UPDATE $cust_tablename SET $field_str WHERE custid = '$custid'";
$result = mysql_query($query);
if(!$result) error_message(sql_error());
$num_rows = mysql_affected_rows($link_id);
if(!$num_rows) error_message("Nothing changed!");
if($custid != $new_custid)
{
$query = "UPDATE $access_log_tablename SET custid = '$new_custid'
WHERE custid = '$custid'";
$result = mysql_query($query);
if(!$result) error_message(sql_error());
user_message("All records regarding $custid have been changed!",
"$PHP_SELF?action=view_record&custid=$new_custid");
}
else
{
user_message("All records regarding $custid have been changed!");
}
}