Yoga, wa aleikum as-salaam (tr: greetings returned to you) > salam, > i'm make a database in mysql, example : > name score A score A Total > john 78 90 > mike 90 70 > etc... > ask me is: > how to make multiple or total in coulum "Total" > otomatically, if me input score in coulom total. > please help me... > (i am sorry my english)
Please don't feel it necessary to apologise for language difficulties. The list language is English - and yet most of the MySQL AB people don't speak English as their native-tongue, so ... May I assume that the second 'score' column is labeled 'score B'? There are two answers! The answer to your specific question is that when you gather the data (presumably an HTML form to PHP), after data-verification checks on $scoreA and $scoreB, compute: $total = $scoreA + $scoreB; then formulate the INSERT statement accordingly. However unless there are clear performance reasons for doing this, you should not store "Totals" in a relation/table because the values in this column are derived (and re-derivable) from the scores - and every time you add a new score, the Total column would need to be changed. Better to (only) store the scores in the table, and calculate the totals when you retrieve the records later, eg SELECT name, scoreA, scoreB, scoreA+scoreB AS Total FROM... Unfortunately that comment on 'normalising' the table may also apply to the scores themselves - should each score/result be held on its own row, rather than having x-columns across the table. SQL/relational theory doesn't work well this way around ('across', it prefers to go 'down') - but that's another question. Fee aman 'illah, (tr: go with God) =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php