trying to make a profile edit page, without separate view and edit page.. HELPPP

hello can some really clever person please help me with this:
i have been trying TWO DAYS STREIGHT, there is somthing missing but when watching videos and reading books they all say the same thing WHY!!! IS!! MINE!! NOT!! WORKING!!!

it pulls the information out of the database fine it just doesnt update

please helppp…

<?php session_start(); if (!isset($_SESSION["manager"])) { header("location: admin_login.php"); exit(); } include "../storescripts/connect_to_mysql.php"; // Be sure to check that this manager SESSION value is in fact in the database $managerID = preg_replace('#[^0-9]#i', '', $_SESSION["id"]); // filter everything but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["manager"]); // filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["password"]); // filter everything but numbers and letters // Run mySQL query to be sure that this person is an admin and that their password session var equals the database information // Gather users info ?> <?php // Script Error Reporting error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php // Parse the form data and add inventory item to the system if (isset($_POST['brand'])) { $brand = mysql_real_escape_string($_POST['brand']); $first = mysql_real_escape_string($_POST['first']); $last = mysql_real_escape_string($_POST['last']); $email = mysql_real_escape_string($_POST['email']); $username = mysql_real_escape_string($_POST['username']); $addressline1 = mysql_real_escape_string($_POST['addressline1']); $addressline2 = mysql_real_escape_string($_POST['addressline2']); $city = mysql_real_escape_string($_POST['city']); $postcode = mysql_real_escape_string($_POST['postcode']); $password = mysql_real_escape_string($_POST['password']); $sql = mysql_query("SELECT id FROM admin WHERE brand='$brand' LIMIT 1"); $productMatch = mysql_num_rows($sql); // count the output amount if ($productMatch > 0) { echo 'Sorry you tried to place a duplicate "Product Name" into the system, click here'; exit(); } // See if that product name is an identical match to another product in the system $sql = mysql_query("UPDATE admin SET brand='$brand', username='$username', first='$first', last='$last', email='$email', addressline1='$addressline1', addressline2='$addressline2', city='$city', postcode='$postcode', password='$password', WHERE id='$id'"); $pid = mysql_insert_id(); } ?> <?php // This block grabs the the admins info where it is echo out and displayed in the form $brand = ""; $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID' "); $adminCount = mysql_num_rows($sql); // count the output amount if ($adminCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $brand = $row ["brand"]; $first = $row ["first"]; $last = $row ["last"]; $username = $row ["username"]; $addressline1 = $row ["addressline1"]; $addressline2 = $row ["addressline2"]; $city = $row ["city"]; $email = $row ["email"]; $password = $row["password"]; } } ?> Store Admin Area
<?php include_once("../template_header.php");?>

Profile: <?php echo $brand; ?> Clothing

admin home Logout
  </tr>
  <tr>
    <td align="right">password</td>
    <td><input name="password" type="password" id="password" size="64" value="<?php echo $password; ?>" /></td>
  </tr>
  
  <tr>
    <td align="right">Address Line 1</td>
    <td><input name="addressline1" type="text" id="addressline1" size="64" value="<?php echo $addressline1; ?>" /></td>
  </tr>
  <tr>
    <td align="right">Address Line 2</td>
    <td><input name="addressline2" type="text" id="addressline2" size="64" value="<?php echo $addressline2; ?>" /></td>
  </tr>
  <tr>
    <td align="right">city</td>
    <td><input name="city" type="text" id="city" size="64" value="<?php echo $city; ?>" /></td>
  </tr>      
  <tr>
    <td>&nbsp;</td>
    <td><label>
Brand
userName
First Name
Last Name
Email


 




<?php include_once("../template_footer.php");?>

You are using deprecated code. You need to use PDO or Mysqli. I have provided a complete PDO database download to get up and running in minutes. We cannot support obsolete code.

I will be happy to help you once you update your code. You may just find you dont even have a problem anymore.

http://www.phphelp.com/forum/the-occasional-tutorial/beginners-pdo-bumpstart-code-use-it-now!

Sponsor our Newsletter | Privacy Policy | Terms of Service