PHP Help needed
So I haven't done any coding in PHP the last...7 years. So I need some help with something:
I need some loop that will go through every record in a table and perform the same action for a variable on each role. I will give a simple example of what I need to do:
I have a table with the following colums: ID, A, B, C .
ID is autofilled, A and B are some variables that are already in the DB. And C will be C=A+B .
So I need some kind of a cycle that will go through each line and fill the C column.
Hope this makes sence, I tried to explain it the best i could with a simple example. I can do this with ASP.NET, however I need to do it in PHP and I am in a dead end at the moment. This should eb something incredibly simple, however I can not manage to do it correctly.
You could just run the following query:
Of course, this will have to be run again every time A or B changes in any row. Ideally, if A and B are going to change often, then
Creally should be calculated when you're going to use it.
Oh, I was just giving an example. I need some foreach (maybe) loop that will execute a specific script for each of the lines of the database, asigning different variables values from each role. I was just giving an example with A, B and C as it is easy to understand.
so.... something like this?
Yup, that while cycle should do the trick. I will update this thread once I get this working or if I need some more help. Thanks Nick, it is apreciated