xQuasar Posted December 7, 2008 Share Posted December 7, 2008 Well, I have a need for one of the cells in mySQL to depend on some other cells. Say, there's a stat, and it depends on the number of weapons. Uhh, jsut for an example, say attack power = 5000 * no. of swords Is there any other way to update attack power, APART from getting the number of swords from mysql, multiplying it by 5000 then changing the attack power cell value to that? Because my game is going to have heaps of weapons. and if i'm going to need to do that... >.> Link to comment https://forums.phpfreaks.com/topic/135894-mysql-cell-value-that-depends-on-other-cell-values/ Share on other sites More sharing options...
Mark Baker Posted December 7, 2008 Share Posted December 7, 2008 You can always create a view that includes all these calculations, then select from the view Link to comment https://forums.phpfreaks.com/topic/135894-mysql-cell-value-that-depends-on-other-cell-values/#findComment-708422 Share on other sites More sharing options...
xQuasar Posted December 7, 2008 Author Share Posted December 7, 2008 What? I don't get it >_> Can you explain in more detail please? Link to comment https://forums.phpfreaks.com/topic/135894-mysql-cell-value-that-depends-on-other-cell-values/#findComment-708711 Share on other sites More sharing options...
Mark Baker Posted December 7, 2008 Share Posted December 7, 2008 Create the view as a one-off exercise CREATE VIEW characterView AS SELECT swords, 5000*swords AS power FROM characterTable; Then, whenever you need to access it, you can select from the view rather than the table SELECT * FROM characterView Link to comment https://forums.phpfreaks.com/topic/135894-mysql-cell-value-that-depends-on-other-cell-values/#findComment-708717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.