Jump to content

Wont Update Info


LostNights

Recommended Posts

It wont update my information in the DB

[code]
<?php

$id = $_GET['id'];

    if (isset($_POST['submitbutton'])) {

mysql_connect('localhost','user','user') or die ("Cannot connect to server");

mysql_select_db("photodirectory") or die ("Cannot connect to database");

$query = "UPDATE corporatelist SET firstname='$_POST[firstname]', lastname='$_POST[lastname]',title='$_POST[title]',department='$_POST[department]',office='$_POST[office]',phone='$_POST[phone]' WHERE sku = '".$id."' ";
$result = mysql_query($query);

        if (!$result) {
            echo "There was a problem with your entry. <a href='infoupdate2.php'>Back</a>";
        } else {
            echo "Your information has been changed.";
        }
    } else {
?>
<?php echo $id; ?>
<form action="infoupdate2.php" method="post">

<p>First Name: <input type="text" maxlength="30" size="32" name="firstname" /></p>

<p>Last Name: <input type="text" maxlength="30" size="32" name="lastname" /></p>

<p>Job Title: <input type="text" maxlength="55" size="57" name="title" /></p>

<p>Department: <input type="text" maxlength="18" size="20" name="department" /></p>

<p>Office: <input type="text" maxlength="4" size="6" name="office" /></p>

<p>Phone Number: <input type="text" maxlength="4" size="6" name="phone" /></p>

<input type="submit" value="Enter Employee Information" name="submitbutton" />

</form>

<?php } ?>
[/code]
Link to comment
Share on other sites

When I change
[code]
$query = "UPDATE corporatelist SET firstname='$_POST[firstname]', lastname='$_POST[lastname]',title='$_POST[title]',department='$_POST[department]',office='$_POST[office]',phone='$_POST[phone]' WHERE sku = '".$id."' ";
[/code]

to
[code]
$query = "UPDATE corporatelist SET firstname='$_POST[firstname]', lastname='$_POST[lastname]',title='$_POST[title]',department='$_POST[department]',office='$_POST[office]',phone='$_POST[phone]' WHERE lastname = 'Benko' ";
[/code]

That changes it for the person whos last name is Benko, so its a problem with the variable.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.