here is a code I based it off of:
<?php
session_start(); // Must start session first thing
/*
Created By Adam Khoury @ [url='http://www.flashbuilding.com/']www.flashbuilding.com[/url]
-----------------------June 20, 2008-----------------------
*/
// Here we run a login check
if (!isset($_SESSION['id'])) {
echo 'Please <a href="login.php">log in</a> to access your account';
exit();
}
//Connect to the database through our include
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$id = $_SESSION['id'];
// Process the form if it is submitted
if ($_POST['username']) {
$name = $_POST['name'];
$phone = $_POST['phone'];
$username = $_POST['username'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$cell = $_POST['cell'];
$email = $_POST['email'];
$sql = mysql_query("UPDATE members SET name='$name', phone='$phone', username='$username', address='$address', city='$city', state='$state', zip='$zip', cell='$cell', email='$email' WHERE id='$id'");
echo 'Your account info has been updated, visitors to your profile will now see the new info.<br /><br />
<meta HTTP-EQUIV="REFRESH" content="3; url=http://final.net46.net/myprofile.php">';
exit();
} // close if post
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE id='$id' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$name = $row["name"];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
}
?>
with a few modifications obviously, and that one works just fine.