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
https://forums.phpfreaks.com/topic/156987-not-updating-right/
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
https://forums.phpfreaks.com/topic/156987-not-updating-right/#findComment-826974
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.