We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,594 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

compare values in DB to update

Hi i have a table Users which have a field "score" to store the current score of the game. Now lets say the user have played a level and has obtain a highest score. So it should update it in the DB. How will i do this comparison? the highest score is store in the variable current score. i need to compare if currentscore>score(in the table) -> then update the field. Anyone can help? it should be in php code

3
Contributors
3
Replies
2 Hours
Discussion Span
3 Months Ago
Last Updated
19
Views
techyworld
Posting Whiz in Training
200 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

How would you like us to help you? We can give directions on how to solve the problem but we won't give the code. Do you have any code to show us?

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 13

I have a field dbscore in my database and it it an array of 5(5 level). lets say i have a new score for level 3. I want to update that score in the database for that particular level. the code below is updating the values but i think it's not correct since the dbscore is an array. Can someone help?

$score is my new score.

mysql_query("UPDATE score SET dbscore='$score' WHERE name='$name'");
techyworld
Posting Whiz in Training
200 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Not sure what your last post here has to do with the original question on this thread. You already asked the question in your last comment in different thread and I answered that question http://www.daniweb.com/web-development/php/threads/450263/update-value-in-db-array

pixelsoul
Master Poster
709 posts since Feb 2011
Reputation Points: 171
Solved Threads: 107
Skill Endorsements: 19

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0658 seconds using 2.73MB