Jump to content

Not updating right.


Bman900

Recommended Posts

Here is my code:

 

mysql_connect("$dbhost", "$dbusername", "$dbpassword") or die(mysql_error());

mysql_select_db("$databasename") or die(mysql_error());

 

  $newtitlecolor = $_POST['titlecolor'];

  $newheadercolor = $_POST['headercolor'];

  $newheaderlink = $_POST['headerlinks'];

  $newnavcolor = $_POST['navbackround'];

  $newnavigationlink = $_POST['navlinks'];

  $newleftsidecolor = $_POST['leftside'];

  $newfootercolor = $_POST['footercolor'];

  $newfootertext = $_POST['footertext'];

 

 

  mysql_query("UPDATE style_options SET styleinput='$newheadercolor' WHERE styleinput='$headercolor' AND id = '1'")

  or die(mysql_error());   

 

    mysql_query("UPDATE style_options SET styleinput='$newnavcolor' WHERE styleinput='$navcolor' AND id = '2'")

  or die(mysql_error()); 

 

        mysql_query("UPDATE style_options SET styleinput='$newleftsidecolor' WHERE styleinput='$leftsidecolor' AND id = '3'")

  or die(mysql_error()); 

 

          mysql_query("UPDATE style_options SET styleinput='$newfootercolor' WHERE styleinput='$footercolor' AND id = '4'")

  or die(mysql_error()); 

 

          mysql_query("UPDATE style_options SET styleinput='$newheaderlink' WHERE styleinput='$headerlink' AND id = '5'")

  or die(mysql_error()); 

 

            mysql_query("UPDATE style_options SET styleinput='$newnavigationlink' WHERE styleinput='$navigationlink' AND id = '6'")

  or die(mysql_error()); 

 

              mysql_query("UPDATE style_options SET styleinput='$newfootertext' WHERE styleinput='$footertext' AND id = '7'")

  or die(mysql_error()); 

 

                mysql_query("UPDATE style_options SET styleinput='$newtitlecolor' WHERE styleinput='$titlecolor' AND id = '8'")

  or die(mysql_error()); 

 

  echo "Update succesfull!<br />";

  echo "<center>[<a href=\"editstyle.php\">Go BACK</a>]</center>";  

 

The Update successful message comes trough but nothing really gets updated. Whats wrong here?

Link to comment
Share on other sites

Sorry about that, I will do it like that next time. I went back and did what you told me and got: 

 

Array ( [titlecolor] => #00FF00 [headercolor] => #00FF00 [headerlinks] => #00FF00 [navbackround] => #00FF00 [navlinks] => #00FF00 [leftside] => #00FF00 [footercolor] => #00FF00 [footertext] => #00FF00 [sumbit] => Submit )

 

 

It looks like the error is with the update code, but everything matches up and it should give me an error if it doesnt. Any guesses?

 

Link to comment
Share on other sites

Easy way to find these errors is to echo your query out, that way you will see the missing variables.

 

I found it, I never included my variables for the original values. Wow am getting old or something...

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.