help needed with a script for members update profile

Hi im working on my web site i can get the script to connect to the mysql but can’t get the page to update the member info when they submit to update i get a blank screen please help
my admin works like a dream with updating the info i just cant get the member part rite.
here is my script if any one knows where im going wrong.

<?php session_start(); session_register("id_session"); session_register("password_session"); include "header.php"; $id=$_SESSION["id_session"]; $password=$_SESSION["password_session"]; if ($id=="" && $password=="") { ?>

Members Login Area

Member's ID
Password
  Forgot Your Password?
<? } else { if (!$_POST) { middle(); } elseif ($_POST["fname"]!="" && $_POST["username"]!="" && $_POST["sponsor"]!="" && $_POST["city"]!="" && $_POST["state"]!="" && $_POST["country"]!="" && $_POST["zip"]!="" && $_POST["email"]!="" && $_POST["password"]!="") { if($password==$_POST["pwd"]) { print "Your Account has been updated successfully
"; $id=$_SESSION["id_session"]; $rs = mysql_query("select * from members where ID=$id"); $arr=mysql_fetch_array($rs); $check=0; $check=1; $db_field[1]=$_POST["fname"]; $db_field[2]=$_POST["username"]; $db_field[3]=$_POST["sponsor"]; $db_field[4]=$_POST["city"]; $db_field[5]=$_POST["state"]; $db_field[6]=$_POST["country"]; $db_field[7]=$_POST["zip"]; $db_field[8]=$_POST["email"]; $query="update members set Name='$db_field[1]', Username='$db_field[2]', Sponsor='$db_field[3]', City='$db_field[4]', State='$db_field[5]', Country='$db_field[6]', Zip='$db_field[7]', Email='$db_field[8]' where ID=$db_field[0]"; $rs = mysql_query($query); } else { print "Invalid Password ! Account cannot be updated!
"; } middle(); } } ?>



<? include "footer.php"; function middle() { include "config.php"; $id=$_SESSION["id_session"]; $rs = mysql_query("select * from members where ID=$id"); $arr=mysql_fetch_array($rs); $fname=$arr[1]; $username=$arr[2]; $sponsor=$arr[3]; $city=$arr[4]; $state=$arr[5]; $country=$arr[6]; $zip=$arr[7]; $email=$arr[8]; $password=$arr[9]; ?>
Update your Personal Information
FULL NAME*
GDI Username*
GDI Sponson*
CITY*
STATE*
COUNTRY*
Postal Code/ZIP CODE*
EMAIL ADDRESS*
PASSWORD*
PASSWORD*
<? return 1; }

?>

Problem may be in header.php or footer.php, or if ID not exists in a member table - you need to check if there are any results returned by query, before fetching array:
[php]$id=$_SESSION[“id_session”];
$rs = mysql_query(“select * from members where ID=”.((int)$id));
if(mysql_num_rows($rs)){
$arr=mysql_fetch_array($rs);
}
[/php]

For debugging purposes, try to turn on error_reporting (either in php.ini or in php code, using function error_reporting()).

well i have tried that and still getting the blank page when editing the details and its not inserting into the data base

Blank screen is not too informative. Did you try turning error_reporting On? Did you check included files for syntax errors: header.php, footer.php ?

when i hit up date info all im getting on the page is header and footer images its not telling me that the data been updated to mysql or is adding the data to the data base.

when i added your code to the script i had a message but im not sure where im meant to add the code string

Function mysql_error() will show what is the problem in your sql query:
[php]$rs = mysql_query(“select * from members where ID=”.((int)$id));
echo mysql_error();[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service