Jump to content

update doesn't work..


kingb00zer
 Share

Recommended Posts

Hi its been a couple of years since i last coded and it seems I have missed out on some recent changes and how it affects php/mysql. I cant seem to get my database to update values and im assuming it is because of php7 or maybe I have completely forgotten how to do so. Im not really interested in learning the new way at this moment as Im just playing around with something to kill time which im running low on and would like to just proceed to do things as i always had. pasted below is the code im using and if it is my code that ist working could someone lease let me know what it is? if it is a case of php7 changes then can someone please tell me how to downgrade my php in xampp so i can continue with my project?, thank you

 

attempting to update multiple entries

mysql_query("UPDATE tracker SET 1= '$onea' 2= '$twoa', 3= '$threea', 4= '$foura', 5= '$fivea', 6= '$sixa', 7= '$sevena' 8= '$eighta', 9= '$ninea', 10= '$tena', 11= '$elevena', 12= '$twelvea', 13= '$thirteena', 14= '$fourteena', 15= '$fifteena', 16= '$sixteena', 17= '$seventeena', 18= '$eighteena', 19= '$nineteena', 20= '$twentya', 21= '$twentyonea', 22= '$twentytwoa', 23= '$twentythreea', 24= '$twentyfoura', 25= '$twentyfivea' WHERE code= '$code' ");

same thing but with single entries

mysql_query("UPDATE tracker SET 1= '$onea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 2= '$twoa' WHERE code='$code'");
mysql_query("UPDATE tracker SET 3= '$threea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 4= '$foura' WHERE code='$code'");
mysql_query("UPDATE tracker SET 5= '$fivea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 6= '$sixa' WHERE code='$code'");
mysql_query("UPDATE tracker SET 7= '$sevena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 8= '$eighta' WHERE code='$code'");
mysql_query("UPDATE tracker SET 9= '$ninea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 10= '$tena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 11= '$elevena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 12= '$twelvea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 13= '$thirteena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 14= '$fourteena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 15= '$fifteena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 16= '$sixteena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 17= '$seventeena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 18= '$eighteena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 19= '$nineteena' WHERE code='$code'");
mysql_query("UPDATE tracker SET 20= '$twentya' WHERE code='$code'");
mysql_query("UPDATE tracker SET 21= '$twentyonea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 22= '$twentytwoa' WHERE code='$code'");
mysql_query("UPDATE tracker SET 23= '$twentythreea' WHERE code='$code'");
mysql_query("UPDATE tracker SET 24= '$twentyfoura' WHERE code='$code'");
mysql_query("UPDATE tracker SET 25= '$twentyfivea' WHERE code='$code'");
Link to comment
Share on other sites

nevermind I fixed it, turns out I am just very rusty. sorry to waste a post.

 

my solution

mysql_query("UPDATE `tracker` SET `1`= '$onea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `2`= '$twoa' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `3`= '$threea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `4`= '$foura' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `5`= '$fivea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `6`= '$sixa' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `7`= '$sevena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `8`= '$eighta' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `9`= '$ninea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `10`= '$tena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `11`= '$elevena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `12`= '$twelvea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `13`= '$thirteena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `14`= '$fourteena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `15`= '$fifteena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `16`= '$sixteena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `17`= '$seventeena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `18`= '$eighteena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `19`= '$nineteena' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `20`= '$twentya' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `21`= '$twentyonea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `22`= '$twentytwoa' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `23`= '$twentythreea' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `24`= '$twentyfoura' WHERE `tracker`.`code`='$code'");
mysql_query("UPDATE `tracker` SET `25`= '$twentyfivea' WHERE `tracker`.`code`='$code'");
Link to comment
Share on other sites

each entry into that table in my database is a stock symbol and 25 price changes, basically im attempting to use an auto refresh every so often to track recent movement of multiple stocks in the same page. just a silly tool im making for fun while im injured and cant work lol. each refresh takes the information from lets say 25 and inserts it into 24 and so on until 1 while the latest price enters into 25. it works now I just got the syntax wrong. im currently having a similar issue with insert but confident ill fix it soon.

 

I created a turn based browser game a while ago but dont have my files with me to use as reference and have not done any php or sql in a couple of years so im forgetting things i used to do in my sleep hehe

Edited by KingB00ZeR
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...