PHP SQL Add words to field in database table
Posted on 2013-11-13
I have a mysql table with the following fields:
id, name, story, rank
I also have 2 authors:
Peter and Paul
I need some code in php what will do the following altogether:
Select * from table where rank = 1
From the output list I need to add the author names into the story fields.
So for example, is the result of the query above is 10 records
Then the name Peter is added to 5 records inside the story field and the name Paul is added to 5 records.
so Peter is added to 50% and Paul is added to 50%
Can anyone help please?