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");?>
<?php include_once("../template_footer.php");?>
Profile: <?php echo $brand; ?> Clothing
admin home LogoutBrand | |
userName | |
First Name | |
Last Name | |